With the base install of nginx, your sites-available folder has just one file: default
how does the sites-available folder work and how would I use it to host multiple (separate) websites?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just to add another approach, you can use a separate file for each virtual domain or site you’re hosting.
You can use a copy of default as a starting point for each one and customize for each site.
Then create symlinks in sites-enabled. In this way you can take sites up and down just by adding or removing a symlink and issuing a service nginx reload.
You can get creative and use this method to redirect sites to a maintenance mode page while you are doing site maintenance.
So the structure looks like this:
Notice that since there are only the first two entries are the only symlinked items in
sites-enabled, the third entry,someOtherSite.comis therefore offline.