我正在努力在同一个服务器的子目录中托管多个laravel项目。
我想在example.com/CoreApp
和example.com/DataSync
中运行laravel项目
- Root directory (example.com): React Js Project
- CoreApp (example.com/CoreApp) : Laravel Project
- DataSync (example.com/DataSync) : Laravel Project
example.com/
=>正常。example.com/CoreApp
=>正常。example.com/DataSync
=>它正在为我404 page
服务,而其其他路线也很好。像example.com/DataSync/telescope is working
一样好。 注意:此外,我在RewriteBase /DataSync
RewriteBase /CoreApp
和.htaccess
服务器配置:
- Digital Ocean Server
- Apache web server
- Ubuntu 16
这是我的虚拟主机的样子。
<VirtualHost *:80>
DocumentRoot /var/www/sites/html
Alias /CoreApp /var/www/sites/html/CoreApp
Alias /DataSync /var/www/sites/html/DataSync
<Directory /var/www/sites/html/CoreApp>
AllowOverride All
DirectoryIndex index.php
</Directory>
<Directory /var/www/sites/html/DataSync>
AllowOverride All
DirectoryIndex index.php
</Directory>
ServerName www.example.com
ServerAlias www.example.com
Redirect permanent / https://example.com/
<Directory "/var/www/sites/html">
Options Includes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerName www.example.com
ServerAlias www.example.com
DocumentRoot /var/www/sites/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateKeyFile /etc/ssl/sites/key/myserver.key
SSLCertificateFile /etc/ssl/sites/certs/example_com.crt
SSLCertificateChainFile /etc/ssl/sites/certs/example_com.ca-bundle
<Directory "/var/www/sites/html">
Options Includes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
答案 0 :(得分:1)
将虚拟主机文件的别名更改为:
Alias /CoreApp /var/www/sites/html/CoreApp/public
Alias /DataSync /var/www/sites/html/DataSync/public
您必须提供公用文件夹的位置
答案 1 :(得分:0)
您应提供的网址最多为您的目录/公共。如果还是问题。然后提供最多您的目录/public/index.php 的URL。