LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 10: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 11:02 AM.
 
Old 07-20-2012, 08:27 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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, 04: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



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 08:49 AM
LXer: Configuring Apache and Nginx LXer Syndicated Linux News 0 07-22-2010 11:10 AM
LXer: Nginx Catch-All Host As Front End To Apache For ISPConfig 3 On Debian Lenny LXer Syndicated Linux News 0 05-20-2010 07:00 PM
Minime server with IPtables forwarding. How to block www by host or IP? AndrzejL Linux - Networking 5 01-06-2009 05:05 AM
How to setting the Virual Domain Mail Server by sendmail? explorer1979 Linux - General 1 06-04-2002 02:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:47 AM.

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
Open Source Consulting | Domain Registration