Apache创建多个站点

2018-12-08  本文已影响8人  西电大侠

需要先设置数据库,这个暂时还没亲自操作,参考如何在Apache上部署多个Wordpress站点上步骤。

下面的是我自己亲自操作的
1、在/var/www下mkdir newsite
2、创建好了文件夹 就把之前的文件夹里的东西拷贝过去
cp -r /var/www/cybersafetrick/* /var/www/newsites/
sudo chown -R www-data:www-data /var/www/newsites/

3、在/etc/apache2/sites-available中
cp 000-default.conf newsite.conf
在newsite.conf中加入

<VirtualHost *:80>
# The primary domain for this host
ServerName example1.com
# Optionally have other subdomains also managed by this Virtual Host
ServerAlias example1.com *.example1.com
DocumentRoot /var/www/html/example1.com/public_html
<Directory /var/www/html/example1.com/public_html>
Require all granted
# Allow local .htaccess to override Apache configuration settings
AllowOverride all
</Directory>

</VirtualHost>

然后sudo a2ensite newsite.conf
然后就是配置.htaccess文件
sudo service apache2 restart重启生效

上一篇 下一篇

猜你喜欢

热点阅读