Hello, I try to setup Multiple Domains in nginx under ubuntu 18 I created new directory with index file: mkdir /var/www/test.com cd /var/www/test.com sudo nano /var/www/test.com.index.html Code (markup): with some text text /var/www/test.com.index.html page sample Code (markup): I create config file: sudo nano /etc/nginx/modules-available/test.com Code (markup): with text: server { listen 80; root /var/www/test.com; index index.html index.htm index.nginx-debian.html; server_name test.com; location / { try_files $uri $uri/ = 404; } } Code (markup): and in hosts: sudo nano /etc/hosts Code (markup): add 1 line : 127.0.0.1 localhost test.com Code (markup): I create symbol link : sudo ln -s /etc/nginx/modules-available/test.com /etc/nginx/sites-enabled/ and Check it I see test.com: cd /etc/nginx/sites-enabled/ ls sudo service nginx restart Code (markup): check : curl test.com [code] I got : $ curl test.com [code]<html> <head><title>403 Forbidden</title></head> <body bgcolor="white"> <center><h1>403 Forbidden</h1></center> <hr><center>nginx/1.14.0 (Ubuntu)</center> </body> </html> Code (markup): but not sample text I enreed above. File /etc/nginx/nginx.conf is default and has lines : include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; Code (markup): 1) Why error and how to fix it ? 2) I suppose I need to disable /etc/nginx/sites-available/default file. How can I do it ?
I am assuming that test.com points to your server. You need to change the permission of the docroot folder /var/www/test.com to nobody or www-data, whatever is nginx running as. chown -R www-data.www-data /var/www/test.com/ Code (markup):
I run your command and restarting with sudo systemctl restart php7.2-fpm sudo service nginx restart Code (markup): It did not help , I have the same error ... Can it be some option or misspelling in modules-available/test.com ?
Check error log for details. modules-available or sites-available? Did you check what user is nginx running with?
Maybe you do not have an index.html file inside the document root. `sudo nano /var/www/test.com.index.html` should be `sudo nano /var/www/test.com/index.html`