LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 07-19-2012, 11:58 AM   #1
takeit
LQ Newbie
 
Registered: Jul 2012
Posts: 8

Rep: Reputation: Disabled
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?

Last edited by takeit; 07-19-2012 at 12:02 PM.
 
Old 07-20-2012, 09:27 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,975

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
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
 
Old 07-25-2012, 05:44 AM   #3
takeit
LQ Newbie
 
Registered: Jul 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
its working now, path was set wrong thanks
 
  


Reply

Tags
conf, nginx, virtual host


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating virual host on apache Gil@LQ Linux - Server 1 11-10-2011 09:49 AM
LXer: Configuring Apache and Nginx LXer Syndicated Linux News 0 07-22-2010 12:10 PM
LXer: Nginx Catch-All Host As Front End To Apache For ISPConfig 3 On Debian Lenny LXer Syndicated Linux News 0 05-20-2010 08:00 PM
Minime server with IPtables forwarding. How to block www by host or IP? AndrzejL Linux - Networking 5 01-06-2009 06:05 AM
How to setting the Virual Domain Mail Server by sendmail? explorer1979 Linux - General 1 06-04-2002 03:26 PM


All times are GMT -5. The time now is 01:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration