Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The Problem: I have 2 domains, 2 web servers, 1 WAN IP. 1 server is hosting www.site1.com, and the other should be hosting, www.site2.com. I forwarded the domain, to a port that is forwarded to that box. wanip:1235, 1235 is then forwarded to the internal IP of site2's server. But when I go to www.site2.com I get the 404 page of www.site1.com.

I need www.site2.com to go to the right server. Is this something I can do in the virtual hosts of www.site1.com or is it something else.

Also, if this isn't entirely possible, or if its a big process, I can just move www.site1.com to the www.site2.com's server, and use virtual hosts, that is an option that I would be okay with.

Update: I found a problem. When I go to my wanip I get the site1.com which is correct, when I go to my wanip:1235 its correct, its site2.com. Perfect. But my site2.com needs /blog/wordpress to be in the right directory, so when I go to www.wanip:1235/blog/wordpress my browser switches it to wanip/blog/wordpress so it goes back to site1.com and 404's because that box doesn't have /blog/wordpress

Why does it decide to ignore the port when I add a directory?

share|improve this question

migrated from serverfault.com Nov 23 '11 at 23:09

This question came from our site for professional system and network administrators.

3  
Questions about home networks are not allowed on Server Fault. Per the FAQ "[Server Fault] is not about Networking outside the professional workplace or Running servers at home". –  Chris S Nov 21 '11 at 17:38
add comment

1 Answer 1

up vote 2 down vote accepted

If you are forwarding 1235 using your router then make sure you have the ip address of site2 correct, because you shouldn't be getting the 404 of site1! Also maybe you copied the config from site1 to site2 and forgot to change the 404??

If you say want site1.com and site2.com to run on the same port, you could forward all requests to site1, then use apaches reverse proxy (http://httpd.apache.org/docs/2.0/mod/mod_proxy.html) to pass the request to site2. However it might just be easier to host all on one server.

share|improve this answer
    
Hmm, no I have 2 ip's 192.168.0.115 (site1) 192.168.0.116 (site2,) its going to site 2, 1235 forwards to port 80 on 192.168.0.116. Its a different config, I didn't copy anything over, just did a fresh install, its on default configs, because site2 has no content yet, just trying to get the domain going to it. –  Tillman32 Nov 21 '11 at 17:41
    
if you open 192.168.0.116 locally do you get site1 404s? Sounds like a router problem if not. –  cosmorogers Nov 21 '11 at 17:47
    
Locally, I get the right page. I guess I'll have to double check everything with my router. But when I go to my WAN IP with a :1235, I also get the right page... maybe my domain isn't forwarding right? Could be a godaddy domain setting? –  Tillman32 Nov 21 '11 at 18:05
    
I actually think I may have located some more info about the problem. When I go to my wan ip with the port :1235, I get the right page... But when I go to my wan ip:1235/blog/wordpress (site2) my browser redirects it to wanip/blog/wordpress and 404's because that directory doesn't exist on site 1... so why is it refusing to use a port when I'm also including a directory? –  Tillman32 Nov 21 '11 at 18:11
    
Thats a wordpress problem then. If I remember correctly you set the domain / server name in wordpress (somewhere). You need to add the port to that setting otherwise it will redirect to that setting –  cosmorogers Nov 21 '11 at 20:08
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.