Wednesday, May 3, 2017

virtualhost - Apache not accessing a symlink vhost directory?



Alright I've been hitting my head against the desk trying to figure out whats going on with this virtual host. I'm able to load the standard html and php files from the default doc root but can't load any virtual hosts.




I'm confused as apache is able to write to the logs directory for the srp.com vhost but the error log just has "[error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /var/www/vhosts". From what I have been reading thats an issue with vhosts being a symlink but I've included the FollowSymLinks option.



What have I over looked when trying to set the vhosts up?



Apache2 is running at www-data user.
Default DocumentRoot is /var/www



/var/www:



drwxrwsr-x 2 www-data www-data 4096 Mar 14 22:49 .

-rw-rw-r-- 1 www-data www-data 64 Nov 27 23:35 index.php
-rw-r--r-- 1 www-data www-data 181 Mar 14 22:13 index.html
lrwxrwxrwx 1 www-data www-data 46 Mar 14 22:49 vhosts -> /mnt/slackhome/krizzo/Dropbox/websites/vhosts/


The /var/www/vhosts/srp.com/ directory:



drwxrwxr-x  5 www-data www-data 4096 Mar 14 22:04 .
drwxrwsr-x 13 www-data www-data 4096 Mar 14 22:02 ..
drwxrwxr-x 2 www-data www-data 4096 Mar 14 22:04 cgi-bin

drwxrwxr-x 8 www-data www-data 4096 Mar 14 22:01 htdocs
drwxrwxr-x 2 www-data www-data 4096 Mar 14 22:18 logs


httpd.conf file




Options Indexes +FollowSymLinks MultiViews
AllowOverride all
Order deny,allow

allow from 127.0.0.1
Deny from all



srp.com (/etc/apache2/sites-available/srp.com)




ServerAdmin webmaster@srp.com
ServerName srp.com

ServerAlias srp.com

# Indexes + Directory Root.
DirectoryIndex index.php index.html
DocumentRoot /var/www/vhosts/srp.com/htdocs/


Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny

Allow from all


# CGI Directory
ScriptAlias /cgi-bin/ /var/www/vhosts/srp.com/cgi-bin/

Options +ExecCGI


# Logfiles

ErrorLog /var/www/vhosts/srp.com/logs/error.log
CustomLog /var/www/vhosts/srp.com/logs/access.log combined


Answer



The solution is to make sure php has the mysql drivers installed. Code Igniter uses the @ to take control of any errors in it's sql module which means the logs will not show anything if there is an issue connecting to the database.



https://stackoverflow.com/questions/15588813/codeigniter-blank-page-and-error-500-in-apache-log


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...