How To Run Nginx with different port other than 80

Saturday, February 4, 2017

How To Run Nginx with different port other than 80

To start nginx via different port(other than 80) there are below steps.

Step 1: Open your config file
            vi /etc/nginx/conf.d/default.conf

Step 2: Change port number on which you are listening;
            listen       81;
           server_name  localhost;

Step 3: Add a rule to iptables
           vi /etc/sysconfig/iptables
           -A INPUT -m state --state NEW -m tcp -p tcp --dport 81 -j ACCEPT

Step 4: Restart IPtables
            service iptables restart;

Step 5: Restart the nginx server
            service nginx restart

Step 6: Now Access your nginx server files on port 81

0 comments:

About This Blog

Lorem Ipsum

  © Copyright 2009 Linux-HelpLine.Blogspot.com

Back to TOP