This Short Guide shows you Step-by-Step How to SetUp a Virtual Host for NGINX Web Server on Ubuntu Linux Distro.
Finally, to the article Bottom there is a Link to Guides for Further NGINX Documentation and Examples.
-
Open Terminal Window
(Press “Enter” to Execute Commands)Cmd and Search “term”
In case first see: Terminal QuickStart Guide.
-
Edit the System Hosts Configuration File
sudo su
nano /etc/hosts
Add a Line Containing your Server Name:
127.0.0.1myservername.com
Ctrl+x to Save & Exit.
-
Edit the Default NGINX Configuration File
nano /etc ginx/sites-enabled/default
Add your Server Configuration:
server {
listen 80;
server_name myservername.com alias www.myservername.com;
root /data/www;
index index.html index.htm;
location /{
try_files $uri $uri/=404;
}
} -
Reload NGINX Web Server:
sudo su -c "nginx -s reload"
-
Access your New Server on Browser:
http://myservername.com
If Also Apache is Running on Port 80 then Possibly Stop It!
-
To Further NGINX Development Examples Go
How to Install Google-Chrome Web Browser on Ubuntu