简体   繁体   中英

How to configure linux/apache for multiple virtualhost in local machine

I have two local web site project, localgoogle.com and localapple.com.

localgoogle.com files are in /home/vahid/dev/localgoogle

localapple.com files are in /home/vahid/dev/localapple

My OS is debian 8.5, I have apache2 installed.

I made /etc/apache2/sites-available/localgoogle.com.conf

and /etc/apache2/sites-available/localapple.com.conf

both linked to /etc/apache2/sites-enabled and enabled by a2ensite command.

This is localgoole.com.conf :

<VirtualHost *:80>
    ServerName localgoogle.com
    ServerAdmin webmaster@localgoogle.com
    DocumentRoot /home/vahid/dev/localgoogle
    ServerAlias www.localgoogle.com
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

localapple conf file follow above configuration rule.

I restarted apache2 service, but I don't know why and how to access this virtualhosts from browser!

I tried localhost/localgoogle.com in browser but It's return Not Found

You access the site directly as localgoogle.com from your browser. Make sure that the name resolves to your local ip address using hosts file or dns.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM