Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Jan 10, 2011 4:49 pm 
Offline
Junior Member

Joined: Sun Nov 14, 2010 9:46 pm
Posts: 28
Hi all, purchased another linode today to experiment with so I don't take my main sites down...

I want to set up Apache and use Nginx as a reverse proxy.
Using this set-up, should I be using Apache or Nginx to set up any virtual hosts?
Thanks in advance for any advice.


Top
   
 Post subject:
PostPosted: Mon Jan 10, 2011 5:49 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
You need to set up both, but restrict apache to listen on 127.0.0.1

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Mon Jan 10, 2011 6:13 pm 
Offline
Junior Member

Joined: Sun Nov 14, 2010 9:46 pm
Posts: 28
Thanks, I have both set up & working, just not sure if I should now be using Apache or Nginx config files for the virtual hosts?


Top
   
 Post subject:
PostPosted: Mon Jan 10, 2011 7:22 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
You need to configure virtual hosts for both, nginx passes the host header onto apache.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Mon Jan 10, 2011 7:29 pm 
Offline
Junior Member

Joined: Sun Nov 14, 2010 9:46 pm
Posts: 28
cool, thanks.
So when I add a new virtual server, say anothersite.com, I need to add it to both Apache & Nginx?

Looking at the nginx files, I thought I would just add location of new sites there?


Top
   
 Post subject:
PostPosted: Mon Jan 10, 2011 8:27 pm 
Offline
Senior Newbie

Joined: Sat Jul 17, 2010 8:32 am
Posts: 12
Apache has to know where to serve the files from for that particular site when nginx passes the request on, so you would have to add a virtual host entry to Apache as well.


Top
   
 Post subject:
PostPosted: Mon Jan 10, 2011 9:44 pm 
Offline
Junior Member

Joined: Sun Nov 14, 2010 9:46 pm
Posts: 28
thanks.
so setting up from start again, I deploy Ubuntu 10.10, followthis tutorial in setting up a LAMP server.
Get virtual hosts working as expected.
Then install Nginx & also add the virtual servers, while I change the apache listening port?


Top
   
 Post subject:
PostPosted: Mon Jan 10, 2011 10:29 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
That sounds like a good plan.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Tue Jan 11, 2011 3:58 am 
Offline
Senior Member

Joined: Sat Nov 13, 2010 3:05 am
Posts: 91
Website: http://www.graq.co.uk
http://httpd.apache.org/docs/2.2/vhosts/
http://wiki.nginx.org/VirtualHostExample

Anything serving files from a hard drive (like a web server) will need to know where those files are. So they must define a base directory (for each domain) from which to look for files. Apache (DocumentRoot) and Nginx (root) are configured independently from one another (they do not share configuration information). So both will need to be configured, no matter whether used in conjunction with each other (e.g. proxying) or not.

Only one application can bind to a port for any given IP address. Typically a trivial setup has Nginx listening on the public IP (your linode IP address) serving static items and passing on any other requests to localhost (127.0.0.1) which not visible to the world. And then Apache listening to localhost deals with PHP and passes that result back to Nginx.

Hope that helps a little :)


Top
   
 Post subject:
PostPosted: Tue Jan 11, 2011 12:23 pm 
Offline
Senior Member

Joined: Sun Feb 21, 2010 5:12 pm
Posts: 64
Depends on how complicated your setup is. You might be able to use one nginx config for all virtual hosts or you might want separate configs.

How many domains, are they all handled identically (same software?) and what is it that you're having nginx do?

If you're going to serve static files directly from nginx, you can put your data in directories named after the domain and use the host variable in the nginx config to let nginx find the files. (i.e. root /var/www/$host/public)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group