By DuGi
Hi,
So I’ve just switch from another VPS provider to Digital Ocean and I’m loving it so far. Also with the switch I chose to switch from Centos 6 to Ubuntu 14. Very nice so far :)
But now I’ve run into a bit of a problem. The VPS is used as a development environment for multiple web developers.
Each developer has their own user and home directory:
/home/developer1/
/home/developer2/
/home/developer3/
etc.
But they are all hosted on the same domain. So i.e. a path to one of their projects could look like this:
http://[PROJECTNAME].{DEVELOPER1}.dev.domain.com
http://[PROJECTNAME].{DEVELOPER2}.dev.domain.com
http://[PROJECTNAME].{DEVELOPER3}.dev.domain.com
This way each developer can have their own version of the same project hosted on the same domain :)
ANYWAY, here’s my problem.
On our previous VPS I used the following vhost file:
<VirtualHost *:80>
ServerName dev.domain.com
ServerAlias *.dev.domain.com
ServerAdmin admin@domain.com
# Set development environemnt variable
SetEnv DEVELOPMENT true
# Enable rewrite for dynamic developer environments
RewriteEngine On
# Dynamic developer environment
RewriteCond %{HTTP_HOST} ^(.+)\.(.+)\.dev.domain.com$
RewriteRule ^/(.*)$ /home/%1/sites/%2/$1 [L]
# Enable .htaccess files
<Directory />
AllowOverride All
</Directory>
# PHP Settings
php_value error_reporting 30719
php_value display_errors On
php_value display_startup_errors On
php_value post_max_size 100M
php_value upload_max_filesize 100M
</VirtualHost>
But now each developer gets a 403 forbidden file. The error.log shows the following message:
[Thu Dec 18 10:41:45.981506 2014] [autoindex:error] [pid 5527] [client 5.103.61.52:61345] AH01276: Cannot serve directory /home/developer1/sites/projectname/: No matching DirectoryIndex (index.php,index.html,index.htm) found, and server-generated directory index forbidden by Options directive
Also might be worth mentioning that our projects we develop are made with the Laravel framework. So each project lands on the root of the project. And in that root here’s a .htaccess file that redirects each request to the /public/ folder. This is to avoid having /public/ appended to all the URL’s in the project.
And it is THAT .htaccess file that doesn’t get executed. We’re never hitting the content of the /public/ folder.
I hope my question make sense and that some of you out there can help a brother out! :)
Merry Christmas and everything from Morten / DuGi
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
I had a similar problem, to fix that I had to update my AllowOverride rule to:
<Directory /var/www/project/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Then I ran a config test:
apachectl -t
I made sure that I got Syntax OK and then restarted Apache:
systemctl restart apache2
Regards, Bobby
This comment has been deleted
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.