LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Configuring virual host (server block) on nginx (https://www.linuxquestions.org/questions/linux-software-2/configuring-virual-host-server-block-on-nginx-4175417622/)

takeit 07-19-2012 10:58 AM

Configuring virual host (server block) on nginx
 
How to properly configure virtual host on nginx?
I have my domain pointed to my dedicated server
I have configured files in /etc/nginx/sites-available/domain1.com

content of domain1.com is:
Code:

server {
  server_name www.domain1.com domain1.com;

  root /var/www/domain1.com;

  access_log /var/log/nginx/domain1.com.access.log;

  index index.html index.php index.htm;

  # serve static files directly
  location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
    access_log off;
    expires max;
  }

  location ~ /\.ht {
    deny  all;
  }
}

I have created symlink to sites-available using ln -s command
my default.conf of nginx points to root /usr/share/nginx/html

I create all with root access, www folder has root ownership and group own, same /www/domain1.com folder,
domain1.com has privilages drwxr-xr-x
I have phpbb forums files (installed) when I enter domain1.com it displays 403 forbidden ..
On apache2 it works fine

Any Idea what is wrong ? why this doesnt work?

bathory 07-20-2012 08:27 AM

Hi,

Quote:

I create all with root access, www folder has root ownership and group own, same /www/domain1.com folder,
domain1.com has privilages drwxr-xr-x
According to the vhost configuration the DocumentRoot is /var/www/domain1.com and not /www/domain1.com as you say above.
Also have a look at the error.log to see what is the reason for the 403 error you get

Regards

takeit 07-25-2012 04:44 AM

its working now, path was set wrong thanks


All times are GMT -5. The time now is 09:39 AM.