Hi there,
I'm running a VPS and have several websites being served under 1 Apache instance. Issue with this is that I'm working on a Django application which would probably require me to restart Apache. Is there any issue to running multiple instances of Apache and each one would be serving a different site? This would allow me to restart one instance without affecting the other.
Unless someone has a better idea?
Thanks!
EDIT Would it be better to run more lightweight webservers to handle simple HTML sites rather than Apache?
-
As long as you point to different logs & bind to a different IP/port, there's no problem with that at all. The obvious question, though, is why do you need to restart Apache?
Tereno : Well, don't I need to restart my server everytime I make a change in my Django apps? Config settings changes and what not I do right?McJeff : http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode I've gotten in the habit of doing something like that or wrapping the whole thing in FastCGI so I can just kill off the children & leave Apache running for other purposes.From McJeff -
To answer your second question: yes, nginx is adept at serving static HTML files, and in fact, there's deployments out there that use nginx as a reverse proxy in order to off load a lot of burden from the main Apache server.
Janne Pikkarainen : Though that kind of setup adds complexity and should only be done if really necessary. Unless the site is VERY high-traffic with thousands and thousands of requests per second, or has some kind of other special needs like serving out huge video files (in the latter case lighttpd/nginx will usually need way less memory than Apache), that should not be necessary at all.From Christian Paredes -
You should try the Django work without any restarting of apache. Most sever side environments work fine while doing development work without any need for stopping and starting the web server over and over again.
But, yes you can run any number of apace instances as long as you make sure your second server's config file is pointing at different resources. Like:
- ports, as long as the port is different you can use the same IP
- log files, this is a big and non obvious one. apache does not usually log though syslog but directly opens it's log files
- might be a few other things that collide, look at every option in httpd.conf
About serving static files. Yes, you can use a lighter web server to do this. But, before you go to the effort be sure that it will do you any good. Is apache really using resources you need elsewhere? Maybe just configure apache to not start quite so many child processes. Be sure the added complication will pay for itself, because down the road it will almost assuredly confuse somebody when they try to figure out how everything is working.
Tereno : Well. if there are any configuration changes, I would still have to restart right? For example, let's assume there's already a completed application and it's live. Now when I add another application, don't I need to restart? I guess Apache is not really using any resources. My only concern is that having to restart - because I'm hosting multiple sites on my VPS, I don't want all sites tied to the same Apache instance in case I have to restart.From Banis -
You can flush Apache's configuration with "apachectl graceful" ("httpd -k graceful").
From Apache's documentation:
Gracefully restarts the Apache httpd daemon. If the daemon is not running, it is started. This differs from a normal restart in that currently open connections are not aborted. A side effect is that old log files will not be closed immediately. This means that if used in a log rotation script, a substantial delay may be necessary to ensure that the old log files are closed before processing them. This command automatically checks the configuration files as in configtest before initiating the restart to make sure Apache doesn't die. This is equivalent to apachectl -k graceful.
From Lekensteyn
0 comments:
Post a Comment