LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   need help with apach virtual hosts ssl/non ssl sites (https://www.linuxquestions.org/questions/linux-networking-3/need-help-with-apach-virtual-hosts-ssl-non-ssl-sites-448106/)

danthach 05-24-2006 10:33 AM

need help with apach virtual hosts ssl/non ssl sites
 
Hi, I have been struggling for days trying to figure out why I can add another non-secure site to my server machine. Im using Apache 2.0 and have site1 using SSL using ports 80 and 443. I need to add a new site2 on port 80. Everytime I type in the site2, I always get the site1. Yes, I have searched the forum, and havent had luck solving my problem. Here is my httpd.conf file. Can someone help please!

Listen 192.168.1.102:80
Listen 192.168.1.102:443
Listen 192.168.1.101:80

<VirtualHost 192.168.1.102:443>
# General setup for the virtual host
DocumentRoot "E:/Programs/Apache Server 2.0/Apache2/test/oscommerce2.2ms2/catalog"
ServerName site1:443
ServerAdmin me
ErrorLog logs/error_log
TransferLog logs/access_log

# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
</virtualhost>

<VirtualHost 192.168.1.101:80>
SSLEngine off
ServerName site2:80
ServerAlias skylightstudios.net *.skylightstudios.net
DocumentRoot "E:/Programs/Apache Server 2.0/Apache2/skylight_studios"
</VirtualHost>

zaichik 05-24-2006 10:48 AM

I'm assuming site1 is listed in httpd.conf first, although you have not shown it. In that case, my first suspicion would be that the host headers are not making it to Apache properly.

If I may over-simplify: When Apache receives a request, it looks to see if there is only one site on the requested IP. If so, it serves it. If not, it checks the host headers. If there is a match between the the IP address and host headers in the requests, it servers that site. If there is no match, it serves the first site listed in httpd.conf.

Try changing "ServerName site2:80" to just "ServerName site2" and see if that resolves the issue.

danthach 05-24-2006 11:01 AM

Hey, thanks for the help. But it didnt work, I get this error.

Forbidden
You don't have permission to access / on this server.

I think I tried every possible solution out there and I still cant get this figured out. BTW, Im a n00b. What are host headers?

zaichik 05-25-2006 06:40 AM

Host headers are additional information sent by a browser to a web server in its request. Behind the scenes, the browser's request for http://site1/index.html really looks like this:
Code:

GET /index.html HTTP/1.1
Host: site1

This allows for name-based hosting, where multiple websites can be hosted on a single IP address.

As for your error, I am assuming you are still trying to get to site2. In that case, I would check the permissions on the directory
E:/Programs/Apache Server 2.0/Apache2/skylight_studios

The Apache user needs to have read and execute permissions on that folder. The Apache user is normally "apache" or "nobody" on *nix systems, not sure on Windows. See if you have either of those users. If not, the Apache installation probably created a default site in E:\Programs\Apache Server 2.0\Apache2, maybe at E:\Programs\Apache Server 2.0\Apache2\var\www\html. If so, check the permissions on that directory to get you going in the direction.


All times are GMT -5. The time now is 10:12 PM.