Jump to content

Another "Apache Vhosts woes" thread


javaguy
 Share

Recommended Posts

Guest emetib

no.

 

ok, go into your /etc/httpd/conf/vhosts/Vhosts.conf

 

put the names of the servers that you want to be running in there.

you are going to have to use the named virtualhosts part.

 

now, don't just use the *, asterisks, put in the ip address of your server. if you are behind a router then put the dhcp address of the server into it and forward your ports of the router. i.e.-

 

router ip 204.147.80.1

server dhcp ip 10.0.0.2

 

now in your router have it so that 204.147.80.1:80 is forwarded to 10.0.0.2:80. in the Vhosts.conf you will have the 10.0.0.2 address in there.

 

################# Named VirtualHosts

NameVirtualHost 65.103.35.243

#<VirtualHost 111.222.33.44>

#ServerName www.domain.tld

#ServerPath /domain

#DocumentRoot /web/domain

#</VirtualHost>

 

<VirtualHost 10.0.0.2>

ServerName benjaminalexandermckee.com

ServerPath /home/javaguy/www/prod/benjaminalexandermckee

DocumentRoot /var/www/html

</VirtualHost>

 

now, in the Vhosts.conf file you will have to change the first line under the named virtualhosts to whatever your ip is. it's the same as the <virtualhost ....> line. now in your /etc/httpd/conf/httpd.conf file you should have a line that asks where your root dir is. that will be /var/www/html, once that is done then you will have to make a symlink to your /home

 

# ln -s /var/www/html/javaguy /home/javaguy/www

 

this will make it so that whatever you put in your /home/javaguy/www folder is running on the web. one point to this. put a pub_html dir, 755, in that javaguy/www folder. this is where your pages will be shown from. don't play with anything other than the doc root in the httpd.conf file.

 

for your pages to be seen you will have to have them index.html, index.php, index.shtml, index.htm ... .

 

hopefully this helps some.

 

for the https you will have to get your mod_ssl going, or start to play with the /etc/ssl(?) files. this is always fun to do.

 

cheers.

Link to comment
Share on other sites

Guest emetib

something else that you could do is to make the doc root /home/java...., personally i wouldnt' do this and i would just write everything that you have to /var/www/html/ . that would be the easiest way. or just make a symlink like i said. one thing about symlinks though, they can be taken over by someone who knows what they are doing and put corrupt code into your system. that is, if someone other than you has access to your server.

 

cheers.

Link to comment
Share on other sites

Okay, I did that, but the page that came up is the "Congratulations! The Web Server software on this system is operational..." page, instead of what I have in /home/javaguy/www/prod/benjaminalexandermckee.

 

Do I have to hard-code the IP address? It looks like I do. The Apache documentation says I can use an asterisk, but it doesn't look like it.

Link to comment
Share on other sites

Okay, I gave up on trying to have the documents under my home directory and moved them to /var/www/html/prod/benjaminalexandermckee. I don't know why it's so problematic to put the document root anywhere else, but I've tried all kinds of combination and haven't been able to make it work. I guess I'm trying to use Apache in a way that wasn't really intended, so I'm going with what works.

 

I greatly appreciate everyone's help.

 

There remains the question of dynamic IP assignment. If I don't have a static IP do I have any options short of purchasing a firewall? That is an option, certainly, but can I do without it?

Link to comment
Share on other sites

Guest emetib

just install shorewall on your box and config it to allow apache and what ever else you might need.

 

# drakfirewall

 

if you don't play around with your nic cards your router should send the same ip number to the same machine each time. once you get your ports working how you want them to just write the config to the router and then reboot it.

 

most routers will assign the dhcp off of the mac address that they have in their mem, config. so you won't have to worry to much about not having the same address if say, the power goes down or you lose connection.

 

cheers.

Link to comment
Share on other sites

Javaguy,

 

I just finished bashing my head against the computer for 2 days over this same problem. I finally got it resolved.

 

You need a line in your httpd2.conf file:

 

NameVirtualHost *

 

- or -

 

NameVirtualHost {ip address here}

 

 

I had that line, but my problem was the same because I needed to change it from * to the actual IP address. Once I did that, and restarted apache2 with service httpd restart I was able to change it back to * and everything works. For some reason, it gets funky if you do a no-no with the SSL and Name-based Virtual Hosts.

 

Hope this helps - I'd hate to think I dented my skull for nothing. :joker:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...