sjl127 Posted February 7, 2009 Share Posted February 7, 2009 Thank you, I'm new... I have on my linux box apache2 and a wordpress install. my /var/www directory is empty except for my website folder, mysitedotcom. I have in my /etc/apache2/sites-available two files, default and mysitedotcom configured using this information: http://linuxhelp.blogspot.com/2006/0...l-machine.html In my /etc/apache2/sites-enabled I have two links named default and mysitedotcom From my host box, it seems I can access everything fine. But, when I'm outside of my lan, and either go to mysite.com or www.mysite.com, I get put into /var/www and not /var/www/mysitedotcom Please help... ??? ??? ??? Quote Link to comment https://forums.phpfreaks.com/topic/144219-solved-virtual-hosting-help-needed-apache2-ubuntu-intrepid/ Share on other sites More sharing options...
wildteen88 Posted February 7, 2009 Share Posted February 7, 2009 The link you posted doesn't work. Post your configuration for mysitedotcom here. For your domain to work you'll need to setup DNS entries so it points to your computers IP Address. Quote Link to comment https://forums.phpfreaks.com/topic/144219-solved-virtual-hosting-help-needed-apache2-ubuntu-intrepid/#findComment-756827 Share on other sites More sharing options...
sjl127 Posted February 7, 2009 Author Share Posted February 7, 2009 This is what's in /var/www/sites-available/mysitedotcom # FILE /etc/apache2/sites-available/mysitedotcom NameVirtualHost mysite.com:80 <VirtualHost mysite.com:80> ServerAdmin webmaster@localhost ServerName mysite.com DocumentRoot /var/www/mysitedotcom/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/mysitedotcom/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost> Quote Link to comment https://forums.phpfreaks.com/topic/144219-solved-virtual-hosting-help-needed-apache2-ubuntu-intrepid/#findComment-756847 Share on other sites More sharing options...
sjl127 Posted February 7, 2009 Author Share Posted February 7, 2009 I’ve searched everywhere and could not find a clear-cut way to configure Apache 2’s new design for linux for virtual hosting. Let my trial-and-error help you have an easier time configuring your set-up. My initial problems were learning how the old httpd.conf differed from the new apache2.conf with the addition of the new folders, sites-available and sites-enabled folders for virtual hosting. When I found some other references and configured as told, when I would go to one of my sites, it would put me into my /var/www/ directory, which of course, has nothing in it except my two website folders. Here’s how it worked for me. I have two website that I host through one IP address. This is my hosting directory structure: /var/www/ contains no files and two folders: /var/www/mysiteone and /var/www/mysitetwo my /etc/apache2/apache2.conf contains nothing new, I did not touch it. my ./etc/apache2/sites-available/mysite1dotcom contains: # FILE /etc/apache2/sites-available/mysite1dotcom NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName mysite1dotcom.com DocumentRoot /var/www/mysite1dotcom/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/mysite1dotcom/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory “/usr/lib/cgi-bin”> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ “/usr/share/doc/” <Directory “/usr/share/doc/”> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost> The important things are at the very top of this file: NameVirtualHost *:80 <VirtualHost *:80> This is what each of your virtual host site files should say. *:80 All I did was copy the ‘default’ file in my sites-available folder, pasted it twice and renaming them mysite1dotcom and mysite2dotcom. Edit them, and make the necessary changes and additions: # FILE NEW VIRTUAL HOST FILE FOR MYSITE1DOTCOM NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory “/usr/lib/cgi-bin”> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ “/usr/share/doc/” <Directory “/usr/share/doc/”> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost> What’s in RED are either additions or changes. Then I created a link to these files in sites-enabled, restarted apache, and it works. I hope this helps! Quote Link to comment https://forums.phpfreaks.com/topic/144219-solved-virtual-hosting-help-needed-apache2-ubuntu-intrepid/#findComment-756923 Share on other sites More sharing options...
wildteen88 Posted February 8, 2009 Share Posted February 8, 2009 NameVirtualHost *:80 should only have to be used once /etc/apache2/apache.conf For understanding Apaches file structure under Ubuntu I found the articles from http://articles.slicehost.com/ubuntu-intrepid very helpful. Quote Link to comment https://forums.phpfreaks.com/topic/144219-solved-virtual-hosting-help-needed-apache2-ubuntu-intrepid/#findComment-757490 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.