I have Apache 2.4 running on Windows Server 2012 with PHP 5.6.23 on port 8080.
Assume that the domain to my server is "serv1.example.com" I need to run 3 Laravel instances production
,staging
and dev
using the following links
serv1.example.com:8080/production
serv1.example.com:8080/staging
serv1.example.com:8080/dev
I found another SO question which seems to be doing the same thing. But when I tried to do the same thing I get the following error
Forbidden
You don't have permission to access /dev on this server.
Here is what I have done so far. In my httpd-vhosts.conf
file I added the following 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>
Then I changed c:\www\dev\public\.htaccess
the code to the following
<IfModule mod_rewrite.c>
#Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /dev/index.php/?$1 [L]
</IfModule>
What did I do wrong here? how can I access each instance using the same domain?
Try This one, in your Apache configure file /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
And in your 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]
I hope this would work. for more information follow these links.Multiple laravelsites on single apache server , multiple web sites in single laravel installation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With