Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Installing Nginx

Nikz Jon edited this page Apr 28, 2015 · 1 revision

Installing Nginx

Tip: Never log in as root. Log in as normal user and use $ sudo su to get root access.

Ubuntu

# apt-get update && apt-get install nginx

Now the Nginx server will be running. Use the following code to initialize server when reboot occurs.

# update-rc.d nginx defaults

Fedora/Centos

Enable extra packages for enterprise linux

# yum install epel-release

Install nginx

# yum update && yum install nginx

To start the server when system reboot

# chkconfig --add nginx

# chkconfig --levels 235 nginx on

Try the following commands if 403 Error occurs,

chcon -R -t httpd_sys_content_t /srv/www/

or

chcon -R -t httpd_sys_rw_content_t /srv/www/


The service name of the server is 'nginx'. You need sudo/root user privilege to use the following commands.

# service nginx start

# service nginx stop

# service nginx restart

To test configuration

# nginx -t

Note: Nginx service need to be restarted when ever nginx configuration is changed.


Check this link for more info