NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. NGINX is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.
You can find more information about NGINX in the official website.
Install NGINX
The installation of NGINX itself is very simple. The “tricky” part is the configuration because you can configure it in very different ways, depending by your necessities.
# sudo apt-get update
# sudo apt-get install nginx
When the installation is complete, check if NGINX is active: # systemctl status nginx
Install extensions
NGINX has some useful extensions, in this guide I’ll show you how to install and use the php extension.
# sudo apt-get install php-fpm php-mysql
# sudo apt-get install php7.0-json php7.0-curl php7.0-imap php7.0-mcrypt php7.0-mcrypt php7.0-xmlrpc php7.0-zip php7.0-zip php7.0-pgsql php7.0-opcache php7.0-cli php7.0-gmp php7.0-fpm php7.0-gd php7.0-xml php7.0-ldap php7.0-intl
Open the PHP Conf: # sudo nano /etc/php/7.0/fpm/php.ini
…
… and edit the line: cgi.fix_pathinfo=0
Then, restart php: # sudo systemctl restart php7.0-fpm
… and restart NGINX: # sudo systemctl restart nginx
Note: If you have a firewall enabled, remember to “open” the ports 80/443 for http/https services.
Useful notes for NGINX
Start NGINX: # sudo systemctl start nginx
Stop NGINX: # sudo systemctl stop nginx
Restart NGINX (Stop + Start): # sudo systemctl restart nginx
Reload configurations: # sudo systemctl reload nginx
Disable start on system boot: # sudo systemctl disable nginx
Re-Enable start on system boot: # sudo systemctl enable nginx
User and group www-data
Config location: /etc/nginx/nginx.conf
Site Available // Enabled location: /etc/nginx/sites-available and /etc/nginx/sites-enabled/
For WordPress (permalink):
location / {
try_files $uri $uri/ /index.php?$args;
}
Leave us your feedback !
Recent Comments
No comments