美文网首页
Apache创建多个站点

Apache创建多个站点

作者: 西电大侠 | 来源:发表于2018-12-08 17:42 被阅读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重启生效

相关文章

网友评论

      本文标题:Apache创建多个站点

      本文链接:https://www.haomeiwen.com/subject/honqhqtx.html