laravel - 如何使用 2 laravel 项目设置 apache

标签 laravel apache ubuntu apache2

首先我复制 000-default.conf

cp 000-default.conf 演示

然后我将演示链接到站点可用

ln -s ../sites-available/demo demo

这是我的000-default.conf我想在 www.example.com 中设置项目运行
<VirtualHost *:80>
     ServerName example.com
     ServerAlias demo.example.com/
     DocumentRoot /var/www/html/test/
     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combin
    </VirtualHost>

这是我想在 demo.example.com 中运行的演示文件
<VirtualHost *:80>
 ServerName www.example.com
 DocumentRoot /var/www/html/main/public
 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined
 <Directory /var/www/html/main/public>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
        </Directory>
</VirtualHost>

之后我运行 service apache2 restart 我只能进入 www.example.com 但我不能进入 demo.example.com 。我不确定我做错了什么

最佳答案

所以我觉得有必要说几件小事-首先,我会离开.conf在复制的文件上。其次,我会一直使用 a2ensitea2dissite启用和禁用任何网站。

在这种情况下,如果您使用 example.com,我也会禁用默认站点。域名。如果您的默认站点当前未启用,这就是您无法访问 demo.example.com 的原因。 - 如果您希望访问该站点,您需要通过运行 a2ensite 000-default 来启用它

关于laravel - 如何使用 2 laravel 项目设置 apache,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55138316/

相关文章:

php - 为什么 phpunit 在控制台中不显示任何错误

Laravel Schema Builder 更新默认值

mysql - 无法在 ubuntu 16.04 上安装 mysql workbench

php - 带有加密列的 laravel 4.2 查询

javascript - 无法解决Ajax、PHP、Json、Laravel(PHP框架)中的代码

php - 在 wampserver 3.0.6 上安装 imagick

regex - Apache 配置: Regex to disable access to files/directories beginning with a dot

apache - 将原生 apache 从 2.2.21 升级到 2.4.2 - Lion 10.7.4

c++ - Iconv 库多次安装导致错误

ubuntu - Letsencrypt Certbot 错误