Author |
|
Bobby Budds
Joined: 18 Oct 2011 Posts: 4
|
Posted: Tue 18 Oct '11 3:28 Post subject: Apache newb trying to setup a Prod and a test server enviro |
|
|
Hello everyone,
I'm a developer and have setup local web server installations of apache. I've never been responisble for a full production web server. Now I am.
Now my question here is:
"I would like to set up a Production server and a Test server. What would be the proper way to go about this on the same physical server?"
For example I was thinking if I setup my website
www.bobby.com
I could maybe setup a test website
www.test.bobby.com
On my test server I can upload my new releases, and do live testing on the server before I push those changes to production.
Maybe you guys can share what the proper way to setup something like this is in the industry. Or if you can think of any better solutions, allowing me to do testing in the live environment please feel free to share them.
Thanks! |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 20 Oct '11 12:07 Post subject: |
|
|
The key word is virtual hosts. So you can run 2 domains with different document roots on the same machine.
if you still have a question please ask again. |
|
Back to top |
|
Bobby Budds
Joined: 18 Oct 2011 Posts: 4
|
Posted: Fri 21 Oct '11 20:26 Post subject: |
|
|
Thank you for the reply.
I do run virtual hosts.
Code: |
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/bobby_prod"
ServerName bobby.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/bobby_test"
ServerName test.bobby.com
</VirtualHost>
|
I think my question more in lies with how to set up zone files and such to make this work, if it looks like my virtual hosts are setup correctly.
While we are on this topic should I change my <VirtualHost *:80> to <VirtualHost 17.24.38.1:80> with the actual static IP rather than *. As well should I change NameVirtualHost *:80 to the actual static IP?
Back to my original question is it good practice to setup test servers in this manner? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Fri 21 Oct '11 22:25 Post subject: |
|
|
Bobby Budds wrote: | how to set up zone files and such to make this work, if it looks like my virtual hosts are setup correctly.
|
Zone files? Do you speak of DNS?
I don't see the need to put an IP into the vhost unless you want to bind it to a specific network card.
The vhosts are almost correct. Only the directory stuff is missing and some logs for each vhost
Code: |
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/bobby_prod"
ServerName bobby.com
ErrorLog "logs/bobby_prod_error.log"
CustomLog "logs/bobby_prod_access.log" common
<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/bobby_prod">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/bobby_test"
ServerName test.bobby.com
ErrorLog "logs/bobby_test_error.log"
CustomLog "logs/bobby_test_access.log" common
<Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/bobby_test">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
|
|
|
Back to top |
|
Bobby Budds
Joined: 18 Oct 2011 Posts: 4
|
Posted: Tue 25 Oct '11 18:48 Post subject: |
|
|
Ya maybe I'm wrong about the zone files. Maybe with this new setup if querying the server for test.bobby.com it will pass the proper header and query my test server. I will give it a try and see what happens.
Thanks for the info. I am update my httpd.conf right now with the new directives on my local server. Although I don't understand why we need all these other directives. I am reading about them and only half understand the reason to do some of them, so I will ask you here.
Nice that I can setup an error log virtual host specific. I did not know that.
Options FollowSymLinks
-I've read that this only needs to be set if you are using mod_rewrite for symbolic links. Is this correct? I am not making use of mod_rewrite on this webapp so do I need to set this? Should I remove it, or is it harmless to leave it in.
AllowOverride All
-From my understanding this directive will allow .htaccess to take precedence over the settings in the httpd.conf? Is this right. Why do I need this as well. I'm not making use of .htaccess files per directory at this time
Order allow, deny
-I think this tells the server to look why a client should be allowed, before looking if they should be denied
Allow from all
-I think this is allowing any ip to connect to the virtual website contained in the directory.
Thanks for all your help so far. The webserver has always been a little confusing and overwhelming to me, so I've always kind of just left it on default settings. Thanks. |
|
Back to top |
|
Bobby Budds
Joined: 18 Oct 2011 Posts: 4
|
Posted: Tue 25 Oct '11 19:17 Post subject: |
|
|
I just wanted to say these custom error logs and access logs are awesome. Thanks a lot man. It was intimidating going with apache over something simpler like iis, but I believe in the software, and it's awesome to find a community with great members willing to help!
I still don't quite understand the directives 100% so I'm eagerly waiting your reply before I put this into my production server. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 25 Oct '11 23:16 Post subject: |
|
|
Bobby Budds wrote: |
Options FollowSymLinks
-I've read that this only needs to be set if you are using mod_rewrite for symbolic links. Is this correct? I am not making use of mod_rewrite on this webapp so do I need to set this? Should I remove it, or is it harmless to leave it in.
|
This has nothing to do with mod rewrite, but the file syste. It is harmless and useful to leave it there.
Bobby Budds wrote: |
AllowOverride All
-From my understanding this directive will allow .htaccess to take precedence over the settings in the httpd.conf? Is this right. Why do I need this as well. I'm not making use of .htaccess files per directory at this time
|
right. You can also set it to
Bobby Budds wrote: |
Order allow, deny
-I think this tells the server to look why a client should be allowed, before looking if they should be denied
|
This is only the which Order the server shall prefer. In this case allow.
Bobby Budds wrote: |
Allow from all
-I think this is allowing any ip to connect to the virtual website contained in the directory.
|
All users shall / can connect to that vhost / directory.
if you still have a question please ask again. |
|
Back to top |
|