MongoDB aborting when running mongod command on terminal - database

when i run mongod command on ubuntu terminal i get this error:
{"t":{"$date":"2020-10-28T22:27:29.341+05:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2020-10-28T22:27:29.348+05:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2020-10-28T22:27:29.349+05:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2020-10-28T22:27:29.349+05:00"},"s":"I", "c":"STORAGE", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":9479,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"E7250"}}
{"t":{"$date":"2020-10-28T22:27:29.349+05:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.1","gitVersion":"ad91a93a5a31e175f5cbf8c69561e788bbc55ce1","openSSLVersion":"OpenSSL 1.1.1f 31 Mar 2020","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu2004","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2020-10-28T22:27:29.349+05:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"20.04"}}}
{"t":{"$date":"2020-10-28T22:27:29.349+05:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}}
{"t":{"$date":"2020-10-28T22:27:29.350+05:00"},"s":"E", "c":"NETWORK", "id":23024, "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted"}}
{"t":{"$date":"2020-10-28T22:27:29.350+05:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":919}}
{"t":{"$date":"2020-10-28T22:27:29.350+05:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
mongod process is running when i enter command sudo systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: ena>
Active: active (running) since Wed 2020-10-28 22:02:55 PKT; 32min ago
Docs: https://docs.mongodb.org/manual
Main PID: 7566 (mongod)
Memory: 159.0M
CGroup: /system.slice/mongod.service
└─7566 /usr/bin/mongod --config /etc/mongod.conf
Oct 28 22:02:55 E7250 systemd[1]: Started MongoDB Database Server.
what went wrong?
etc/mongod.conf file
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:

This works for me:
Stop mongod process by entering the following command in terminal: sudo systemctl stop mongod
You have to make directory for "dbPath" with following command: sudo mkdir -p /data/db and sudo chown -R `id -un` /data/db
Then run sudo mongod --port 27017
Done!
you can't run sudo systemctl start mongod and sudo mongod --port 27017 at same time. Stop mongod by sudo systemctl stop mongod then run sudo mongod --port 27017
Hope this solution works for all who have same problem.

When you start the mongod service with sudo systemctl start mongod then the systemd reads the service file /usr/lib/systemd/system/mongod.service.
By default it sets the user to mongod and reads the config file /etc/mongod.conf:
[Service]
User=mongod
Group=mongod
Environment="OPTIONS=-f /etc/mongod.conf"
When you start the service with sudo mongod then your mongo runs as root and no config file is read.
In the default mongod.conf file the dbPath is set to
# Where and how to store data.
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
However, when dbPath is not provided then default /data/db applies.
You may start the MongoDB with sudo mongod -f /etc/mongod.conf which correspond to sudo systemctl start mongod - however your mongod is running as root rather than mongod user.
Note, usually you don't edit settings directly in /usr/lib/systemd/system/mongod.service file. Create a copy to /etc/systemd/system/mongod.service and customize this copy. See https://unix.stackexchange.com/questions/206315/whats-the-difference-between-usr-lib-systemd-system-and-etc-systemd-system

Related

Opencv is not working in wsgi apache server

jpg_original = base64.b64decode(img_str.encode("utf-8"))
jpg_as_np = np.frombuffer(jpg_original, dtype=np.uint8)
img_matlab = cv2.imdecode(jpg_as_np, flags=1)
I am trying decode base64 image in apache server,numy operation is working control is stucked at imdecode part. I am new in apache wsgi. Dont know what I am missing. I am sharing apache2.conf
<VirtualHost *:80>
# Python application integration
WSGIDaemonProcess /apache-flask processes=1 threads=4 python-path=/var/www/apache-flask/:/usr/bin/python
WSGIProcessGroup /apache-flask
WSGIScriptAlias / /var/www/apache-flask/apache-flask.wsgi
<Directory "/var/www/apache-flask/app/">
Header set Access-Control-Allow-Origin "*"
WSGIProcessGroup /apache-flask
WSGIApplicationGroup %{GLOBAL}
Options +ExecCGI
Order deny,allow
Allow from all
</Directory>
Alias /static /var/www/apache-flask/app/static
<Directory /var/www/apache-flask/app/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I have build docker image for apache server. Below is the Dockerfile.
# Set the base image
FROM debian:latest
# File Author / Maintainer
MAINTAINER nitinashu1995#gmail.com
RUN apt-get update -y
RUN apt-get install python3-pip apache2 libapache2-mod-wsgi-py3 -y
RUN apt-get -y install libapache2-mod-wsgi-py3
RUN apt-get install -y apache2
RUN pip3 install -U Flask
RUN pip3 install pymongo
RUN apt-get install iputils-ping -y
RUN apt-get install vim -y
RUN pip3 install pytz
RUN pip3 install -U flask-cors
RUN apt update
# Copy over and install the requirements
COPY ./app/requirements.txt /var/www/apache-flask/app/requirements.txt
RUN pip install -r /var/www/apache-flask/app/requirements.txt
# Copy over the apache configuration file and enable the site
COPY ./apache-flask.conf /etc/apache2/sites-available/apache-flask.conf
RUN a2ensite apache-flask
RUN a2enmod headers
# Copy over the wsgi file
COPY ./apache-flask.wsgi /var/www/apache-flask/apache-flask.wsgi
COPY ./run.py /var/www/apache-flask/run.py
COPY ./app /var/www/apache-flask/app/
RUN a2dissite 000-default.conf
RUN a2ensite apache-flask.conf
# LINK apache config to docker logs.
RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
ln -sf /proc/self/fd/1 /var/log/apache2/error.log
EXPOSE 80
WORKDIR /var/www/apache-flask
RUN pip install opencv-python-headless==4.5.3.56 numpy
RUN apt install cmake -y
RUN pip install face_recognition
CMD /usr/sbin/apache2ctl -D FOREGROUND
I am not able to run opencv with apache2, I am getting timeout.
[Tue Dec 27 10:15:03.701128 2022] [wsgi:error] [pid 11:tid 140363481642752] [client 192.168.0.138:41568] Timeout when reading response headers from daemon process '/apache-flask':
/var/www/apache-flask/apache-flask.wsgi
I am able to run opencv within container seems some configuration is missing.
Not able to find whats wrong.

Impossibility to set new dbpath in MongoDB

Versions:
Mongodb -> v5.0.9
Ubuntu -> 18.04 64 bits with architecture x86_64
For some purposes I prefer to change the folder containing my database in MongoDB.
First I made the folder the property of the mongodb group: sudo chgrp mongodb /newpath/mongodatabases and it's alright, it did it:
avy#machine:~/newpath$ ls-l
drwxrwxrwx 2 avy mongodb 4096 juin 20 05:24 mongodatabases
Second I tried to set the new path by the book: (base) avy#machine:~$ mongod --dbpath /newpath/mongodatabases
but it gave me the following display with some errors:
{"t":{"$date":"2022-06-20T05:56:54.897+02:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":13},"outgoing":{"minWireVersion":0,"maxWireVersion":13},"isInternalClient":true}}}
{"t":{"$date":"2022-06-20T05:56:54.900+02:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2022-06-20T05:56:54.901+02:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2022-06-20T05:56:54.901+02:00"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2022-06-20T05:56:54.903+02:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2022-06-20T05:56:54.903+02:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","ns":"config.tenantMigrationDonors"}}
{"t":{"$date":"2022-06-20T05:56:54.903+02:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","ns":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2022-06-20T05:56:54.903+02:00"},"s":"I", "c":"CONTROL", "id":5945603, "ctx":"main","msg":"Multi threading initialized"}
{"t":{"$date":"2022-06-20T05:56:54.904+02:00"},"s":"I", "c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":9691,"port":27017,"dbPath":"/newpath/mongodatabases","architecture":"64-bit","host":"machine"}}
{"t":{"$date":"2022-06-20T05:56:54.904+02:00"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"5.0.9","gitVersion":"6f7dae919422dcd7f4892c10ff20cdc721ad00e6","openSSLVersion":"OpenSSL 1.1.1 11 Sep 2018","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2022-06-20T05:56:54.904+02:00"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
{"t":{"$date":"2022-06-20T05:56:54.904+02:00"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"storage":{"dbPath":"/newpath/mongodatabases"}}}}
{"t":{"$date":"2022-06-20T05:56:54.905+02:00"},"s":"E", "c":"NETWORK", "id":23024, "ctx":"initandlisten","msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted"}}
{"t":{"$date":"2022-06-20T05:56:54.905+02:00"},"s":"F", "c":"-", "id":23091, "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":1019}}
{"t":{"$date":"2022-06-20T05:56:54.905+02:00"},"s":"F", "c":"-", "id":23092, "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}
Considering the message "msg":"Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted" I checked the ownership of the file /tmp/mongodb-27017.sock and it actually is owned by mongodb
(base) avy#machine:~$ ls -ls /tmp/mongodb-27017.sock
0 srwx------ 1 mongodb mongodb 0 juin 20 05:50 /tmp/mongodb-27017.sock
Besides mongod seems to have no problem to work itself:
(base) avy#machine:~$ sudo service mongod status
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: e
Active: active (running) since Mon 2022-06-20 05:50:00 CEST; 1s ago
Docs: https://docs.mongodb.org/manual
Main PID: 8980 (mongod)
CGroup: /system.slice/mongod.service
└─8980 /usr/bin/mongod --config /etc/mongod.conf
juin 20 05:50:00 avywam systemd[1]: Started MongoDB Database Server.
What should I do to make it done ?
Follow the instructions below:
Access your running instance and shutdwon it if it is running:
mongo --port 27017
use admin
db.shutdownServer({force:true})
Check if the file exists still and if exists remove it via:
rm /tmp/mongodb-27017.sock
( Sometimes if the mongod process was not running , there is possible the mongod process didn't exited properly and sock file to be still there preventing the new instance to start. )
Start again your mongod service via: ( the dbPath need to be set to the new location before doing this )
sudo service mongod start
Mark the answer as useful and accepted so I get 25 points for the hint :)

Changed MongoDB port but still tries default port

I changed the port in the /etc/mongod.conf file ie
net:
port: 12345
bindIp: 127.0.0.1,123.123.23.255 #localhost and server pub ip
Then I restarted mongo
sudo systemctl restart mongod.service
and checked all ok:
sudo systemctl status mongod
mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2018-07-10 13:35:14 UTC; 16s ago
Docs: https://docs.mongodb.org/manual
Main PID: 1927 (mongod)
Tasks: 23
Memory: 136.3M
CPU: 1.240s
CGroup: /system.slice/mongod.service
└─1927 /usr/bin/mongod --config /etc/mongod.conf
Then I tried to login to mongo:
mongo --username me --password my_password --authenticationDatabase authdb
And got the following error:
MongoDB shell version v3.6.5
connecting to: mongodb://127.0.0.1:27017
2018-07-10T13:29:14.716+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2018-07-10T13:29:14.717+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
I then changed the port back to 27017 in mongod.conf and could login to the db OK.
Any idea why the mongo shell tries 27017 even though mongo port is changed?
You're confusing between mongo server (the server you configure when you change .conf file) and mongo client you used to connect to mongo server. If you changed your port to 12345, then you must precise it when you try to connect, providing it in the connecting command :
mongo --username me --password my_password --authenticationDatabase authdb --port 12345
or
mongo --username me --password my_password --authenticationDatabase authdb --host 127.0.0.1:12345
EDIT : without any port specification in mongo command, default one will be used, so 27017.

Exception in thread "main" org.apache.solr.client.solrj.SolrServerException: Server refused connection at: http://localhost:8983/solr

I am trying to run solr(5.2.1) using;
$ bin/solr start -e cloud -noprompt
But I get
Welcome to the SolrCloud example!
Starting up 2 Solr nodes for your example SolrCloud cluster.
Starting up SolrCloud node1 on port 8983 using command:
solr start -cloud -s example/cloud/node1/solr -p 8983 -m 512m
Waiting to see Solr listening on port 8983 [/] Still not seeing Solr listening on 8983 after 30 seconds!
tail: cannot open '/home/altair/Solr/example/cloud/node1/solr/../logs/solr.log' for reading: No such file or directory
Starting node2 on port 7574 using command:
solr start -cloud -s example/cloud/node2/solr -p 7574 -z localhost:9983 -m 512m
Waiting to see Solr listening on port 7574 [/] Still not seeing Solr listening on 7574 after 30 seconds!
tail: cannot open '/home/altair/Solr/example/cloud/node2/solr/../logs/solr.log' for reading: No such file or directory
WARN - 2015-07-02 10:22:47.156; org.apache.solr.util.SolrCLI; Request to http://localhost:8983/solr/admin/info/system failed due to: Connection refused, sleeping for 5 seconds before re-trying the request ...
Exception in thread "main" java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:220)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139)
at org.apache.solr.util.SolrCLI.getJson(SolrCLI.java:527)
at org.apache.solr.util.SolrCLI.getJson(SolrCLI.java:471)
at org.apache.solr.util.SolrCLI.getJson(SolrCLI.java:481)
at org.apache.solr.util.SolrCLI.getZkHost(SolrCLI.java:1156)
at org.apache.solr.util.SolrCLI$CreateCollectionTool.runTool(SolrCLI.java:1210)
at org.apache.solr.util.SolrCLI.main(SolrCLI.java:215)
Enabling auto soft-commits with maxTime 3 secs using the Config API
POSTing request to Config API: http://localhost:8983/solr/gettingstarted/config
{"set-property":{"updateHandler.autoSoftCommit.maxTime":"3000"}}
Exception in thread "main" org.apache.solr.client.solrj.SolrServerException: Server refused connection at: http://localhost:8983/solr
at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:567)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:235)
at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:227)
at org.apache.solr.client.solrj.SolrClient.request(SolrClient.java:1220)
at org.apache.solr.util.SolrCLI.postJsonToSolr(SolrCLI.java:1882)
at org.apache.solr.util.SolrCLI$ConfigTool.runTool(SolrCLI.java:1856)
at org.apache.solr.util.SolrCLI.main(SolrCLI.java:215)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:466)
... 6 more
SolrCloud example running, please visit http://localhost:8983/solr
I have done some search but I get nothing. I have started solr using same command before but this time I get this.
What is the reason of this error and how can I fix it.
Try starting without -e option (without including any example). I got the same problem, even could not be resolved by restarting the system. It worked when I removed command to include example at the start time.
FYI : bin/solr start -noprompt

Unable to access Apache2 HTTPD server on browser from remote machine

I have a website deployed on Apache2. The Apache2 server is setup on a VM.
When I try to access the site using a browser from a remote machine (my laptop), I get a connection timed out error.
When I try to access something deployed on Tomcat on the same VM it works fine. But Apache gives a problem.
Please let me know what I am missing.
Thanks.
1) check that the httpd process is running
ps -ef | grep httpd |grep -v grep
2) make sure you are broadcasting on port 80
netstat -atn |grep :80
3) verify in your conf (/etc/httpd/conf.d/*.conf) file that you are binding Apache to port 80
<virtualhost *:80>
or
<virtualhost xxx.xxx.xxx.xxx:80>
Your Tomcat process may be bound to port 80 and the socket is not available.
on centos run this commands:
iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
/etc/init.d/iptables save

Resources