欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

linux服务器多域名设置

程序员文章站 2022-07-12 22:32:28
...

系统Ubuntu 14.04


sudo mkdir -p /var/www/example.com/public_html
sudo mkdir -p /var/www/test.com/public_html


sudo chmod -R 755 /var/www


sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.conf


sudo vim /etc/apache2/sites-available/example.com.conf


<VirtualHost *:80>
	ServerAdmin [email protected]
	ServerName example.com
	ServerAlias www.example.com
	DocumentRoot /var/www/example.com/public_html
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


sudo a2ensite example.com.conf
sudo service apache2 restart