Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
having trouble setting up virtual hosts on my machine.
intro:
suse 9.2 pro
apache2
laptop
internal NIC gets address via DHCP
pcmcia wireless NIC gets address via DHCP
trying to do this w/o YaST so I know exactly what files are getting changed and how.
I'm trying to set up name-based virtual hosting. in my httpd.conf file i have the default server set as such (in default-server.conf):
===============================
ServerName ortiz
DocumentRoot "/srv/www/htdocs"
ServerAdmin root@mymachine.us
#
# Configure the DocumentRoot
#
<Directory "/srv/www/htdocs">
Options Indexes Includes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
/=================================
And in my virtual hosts file i have this in vhosts.d/local-sites.conf
<VirtualHost *>
DocumentRoot /srv/www/nthdegree/public_html
ServerName nthdegree
ServerAdmin this@this.com
# Other directives here
</VirtualHost>
/=================================
SO.... The default host works fine and it serves up all the pages below the default document root. But when I try to look at //nthdegree/ it won't find the site. I put an IP address into /etc/hosts for nthdegree, but the browser still says "the connection was refused when trying to contact nthdegree".
I know the local-sites.conf file is getting loaded because at some point messing around w/ the hosts files I got the server to spit out a 403 error when trying to hit //nthdegree, which prints out the host name and serverAdmin email address. Checking on the 403 error, I figured out that I did not have a permissions issue because files under the default documentRoot with the same permissions and ownership can be seen in a browser.
I don't have much experience setting up apache, but my old apache 1.3 config (IP-based) worked fine. When I needed to add a new virtual host, I'd add the virtual host info in httpd.conf and add an IP address in /etc/hosts and it would show up. I moved to name-based hosts because I figured my laptop would be getting DHCP addresses and I shouldn't rely too much on IP-based configurations.
So, I don't know if I need to add something to my hosts files or DNS entries or what, or what files need to be changed so that the new virtual hosts are resolved. Been hacking away at this for hours and can not figure it out. Any help is much appreciated.
I noticed when I was messing around w/ my hosts files that DHCP automatically updates some files. I can turn this setting off, but I'm not sure if this is what is causing the problem.
ortiz is the machine name and default host. that all works fine.
linux.site i think is something Yast threw in there at some point. //linux points to the default documentRoot via a server alias.
I Just stuck in the 127.0.0.3 address and now I get a 403 error "Access forbidden! You don't have permission to access the requested object. It is either read-protected or not readable by the server." But I'm pretty sure it's not a permissions issue. At some point when I was setting up IP-based virtual hosts I got my nthdegree site to come up fine, so I believe apache can read the files. But after I rebooted I think DHCP did something to my hosts files and so I decided to set up name-based virtual hosts instead.
i don't want to use multiple IPs. i was thinking it was a hosts issue so that's where i've been flailing around.
when i put an entry in for nthdegree i get the 403 error. when there's no entry, i don't get anything. so i figured i was closer w/ the hosts file than anything else i was trying.
OK, if you don't need multiple IPs then just set them all to the loopback:
127.0.0.1 localhost nthdegree domain1 domain2 etc
If you are getting 403 errors then you have got the hosts bit working but apache is refusing to show you the document you are accessing. Do you have an index file in place? If so then make sure the webserver has permision to read it.
can i have them on separate lines or will hosts get confused?
ie
127.0.0.1 localhost
127.0.0.1 nthdegree
etc.
strange thing, i'm still getting the 403 error. all the files in the virtual host directory are owned the same and have the same permissions as the default host.
linux:/home/russell # ls -al /srv/www/nthdegree/public_html/
total 105
drwxrwxr-x 11 russell 500 808 2005-03-20 09:54 .
drwxr-xr-x 9 russell 500 408 2005-03-15 16:11 ..
drwxrwxr-x 9 russell 500 2120 2005-03-15 16:14 catalog
drwxrwxr-x 3 russell 500 192 2005-02-02 17:01 cgi-bin
-rw-r--r-- 1 russell 500 5464 2005-02-21 21:51 contact.php
-rw-r--r-- 1 russell 500 155 2005-02-25 15:29 contact_success.php
drwxrwxr-x 2 russell 500 160 2005-03-16 07:33 CVS
-rw-r--r-- 1 russell 500 11169 2005-02-25 15:27 dealer_application.php
-rw-r--r-- 1 russell 500 158 2005-02-25 15:27 dealer_app_success.php
drwxrwxr-x 3 russell 500 144 2005-02-28 09:48 docs
-rw-rw-r-- 1 russell 500 6168 2005-02-24 10:03 faq.php
-rw-rw-r-- 1 russell 500 894 2005-01-31 22:16 favicon.ico
drwxrwxr-x 3 russell 500 232 2005-02-11 17:25 front_page_images
-rwxrwxr-x 1 russell 500 116 2005-03-15 15:12 .htaccess
drwxrwxr-x 4 russell 500 808 2005-02-23 05:28 images
-rw-rw-r-- 1 russell 500 868 2005-01-31 22:16 index_dev.html
-rw-r--r-- 1 root root 21 2005-03-20 09:54 index.html
-rw-r--r-- 1 russell 500 6008 2005-02-17 16:35 index.php
-rw-rw-r-- 1 russell 500 19 2005-01-31 22:16 info.php
-rw-rw-r-- 1 russell 500 10240 2005-02-03 14:33 local.tar
-rw-rw-r-- 1 russell 500 9059 2005-02-27 13:52 locator.php
-rw-rw-r-- 1 russell 500 144 2005-02-09 20:54 news.php
-rw-rw-r-- 1 russell 500 844 2005-03-11 16:14 print_button_page.php
drwxrwxr-x 8 russell 500 1560 2005-03-08 15:55 storeadmin
drwxrwxr-x 3 russell 500 112 2005-02-02 17:01 style
drwxrwxr-x 3 russell 500 872 2005-02-26 19:12 templates
-rw-rw-r-- 1 russell 500 143 2005-02-09 20:54 who.php
linux:/home/russell # ls -al /srv/www/htdocs/test
total 5
drwxr-xr-x 2 root root 80 2005-03-20 11:29 .
drwxr-xr-x 26 root root 1080 2005-03-20 11:28 ..
-rw-r--r-- 1 root root 20 2005-03-20 11:29 index.html
=====================================
i threw in the ls -al /srv/www/htdocs/test to show that //ortiz/test/index.html is showing up fine, and it has the same permissions as the virtual host directory.
[Sun Mar 20 11:27:44 2005] [error] [client 127.0.0.1] client denied by server configuration: /srv/www/nthdegree/public_html/
[Sun Mar 20 11:27:45 2005] [error] [client 127.0.0.1] client denied by server configuration: /srv/www/nthdegree/public_html/favicon.ico
[Sun Mar 20 11:34:35 2005] [error] [client 127.0.0.1] client denied by server configuration: /srv/www/nthdegree/public_html/index.html
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.