Thursday, September 7, 2017

localhost - editing apache vhosts and ubuntu hosts file?

I have just installed ubuntu (11.04).



I have installed apache/mysql/php etc.



I have a few sites sitting in



/var/www/site1
/var/www/site2
/var/www/site3



I want to be able to access these at
http://site1.local
http://site2.local
http://site3.local




So in my hosts file I have
127.0.0.1 site1.local
127.0.0.1 site2.local
127.0.0.1 site3.local



Then I have copied /etc/apache2/sites-available/default 3 times.



so now I have
/etc/apache2/sites-available/site1
/etc/apache2/sites-available/site2
/etc/apache2/sites-available/site3



These all look like (with appropriate sitex names)




ServerAdmin webmaster@localhost


DocumentRoot /var/www/site1

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny

allow from all


ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all



ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/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






In the terminal I then call



sudo a2ensite site1 site2 site3 && sudo /etc/init.d/apache2 reload



Which seems to work,
except only one of the vhosts works at the same time (including default),
What am I doing wrong?






When I run the reload command I get



  • Reloading web server config apache2
    apache2: Could not reliably determine the server's fully qualified domain name,
    using 127.0.1.1 for ServerName
    [Fri Apr 15 10:45:27 2011] [warn]
    NameVirtualHost *:80 has no
    VirtualHosts


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...