Jay*_*len 5 php apache .htaccess laravel laravel-5
我在Windows Server 2012上运行Apache 2.4,在端口8080上运行PHP 5.6.23.
假设我的服务器的域是"serv1.example.com"我需要运行3个Laravel实例production,staging并dev使用以下链接
serv1.example.com:8080/production
serv1.example.com:8080/staging
serv1.example.com:8080/dev
Run Code Online (Sandbox Code Playgroud)
我发现了另一个似乎在做同样事情的SO问题.但是当我尝试做同样的事情时,我得到以下错误
Forbidden
You don't have permission to access /dev on this server.
Run Code Online (Sandbox Code Playgroud)
这是我到目前为止所做的.在我的httpd-vhosts.conf文件中,我添加了以下VirtualHost
<VirtualHost *:8080>
ErrorLog "logs/dev-error.log"
CustomLog "logs/dev-access.log" common
DocumentRoot "C:\www\dev\public"
ServerName serv1.example.com
ServerAlias /dev
<Directory "C:\www\dev">
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig FileInfo Indexes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
然后我c:\www\dev\public\.htaccess将代码更改为以下内容
<IfModule mod_rewrite.c>
#Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /dev/index.php/?$1 [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
我在这做错了什么?如何使用相同的域访问每个实例?
在您的 Apache 配置文件中尝试一下这个/etc/apache2/sites-available
<VirtualHost *:8080>
ServerName serv1.example.com
ServerAlias serv1.example.com
DocumentRoot "C:/www/dev/public"
# Rewrites for pretty URLs, better not to rely on .htaccess.
<Directory "C:/www/dev/public">
Options All
AllowOverride All
Require all granted
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
</Directory>
# Log file locations
LogLevel warn
ErrorLog "logs/dev-error.log"
CustomLog "logs/dev-access.log" common
Run Code Online (Sandbox Code Playgroud)
而在你的c:\www\dev\public\.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Run Code Online (Sandbox Code Playgroud)
我希望这会起作用。欲了解更多信息,请点击这些链接。单个 apache 服务器上有多个 laravel 站点,单个 laravel 安装中有多个网站
| 归档时间: |
|
| 查看次数: |
1119 次 |
| 最近记录: |