I am new Nginx
. Currently, I configured my domain to be served by Nginx
on the default
configuration as follows and it is working.
sudo nano /etc/nginx/sites-available/default
Default configuration:
server {
listen 80;
server_name uidcenterkl.my *.uidcenterkl.my;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
However, I learnt that I need to create domain specific directive such as mywebiste.com.conf
as follows:
sudo nano /etc/nginx/sites-available/mywebiste.com.conf
Question:
What should I choose, default
or mywesbite.com.conf
to serve a single domain? And if I went with mywebsite.com.conf
, how to deactivate default
configuration so that it does not cause conflict.
CodePudding user response:
You may actually not need to set up domain specific directive to serve a single domain. default
directive should work fine for you.
And if you choose to use mywesbite.com.conf
, all you need to do to disable default
is to delete it from inside sites-enabled
directory
After creating your mywesbite.com.conf
feel free to delete the default.conf
by running this command from your sites-enabled
dirctory:
sudo rm ../sites-enabled/default.conf
Don't forget to restart your nginx
after that command
systemctl restart nginx