jeudi 29 décembre 2016

lundi 12 décembre 2016

[Linux] Install, Configure and Use NGINX on Ubuntu

  Aucun commentaire
Hello everyone,

Installing NGINX on Ubuntu is very easy, just follow the following commands:
sudo apt-get update
sudo apt-get install nginx 
For those who want to install NGINX but they have Apache pre-installed in their Linux, and they can't access to NGINX files and web pages, here's a solution:
Apache uses the :80 as a default port, and NGINX do so, to fix this problem we must change the NGINX port to something else, let's take :90 as example.

Here's a few lines that help you to change NGINX default port:
vi /etc/nginx/sites-available/default
Change the lines :
server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

To :
server {
        listen 90 default_server;
        listen [::]:90 default_server ipv6only=on;
 Then save the file ... and restart NGINX service by typing the command below:
service nginx restart
That's it!

Now go the address : http://ip_of_your_server:90  (change ip_of_your_server with your server ip)
Then you should get this page :


To add files & web pages go to this directory:
cd /usr/share/nginx/html/