0

I have a fresh installation of Apache/2.4.7 (Ubuntu), running a LAMP stack. I've transferred all my files to the new server and I'm getting the following error when trying to access a subdomain, the actual domain works fine:

Forbidden You don't have permission to access /index.php on this server.

I've done quite a bit of searching and this thread seems to have the most solutions (most of which I've tried).

Here is my apache2.conf file:

<Directory />
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>

What's strange is the sub-domain is just basically a mask through .htaccess, therefore the website content never leaves /var/www/example_com - my permissions on 'www' is 755, and I have full root access.

I'm quite confused as I can't seem to find anything to work that would allow me to access a subdomain of my main domain: sub.example.com - just gives me 403.

Any help is greatly appreciated.

Edit (more information on my .htaccess file) The permissions on my .htaccess file are 755, and it's not changed in months. It worked on the previous server which ran the same LAMP stack but was just an older version of Ubuntu.

RewriteEngine on
RewriteCond $1 !^(index\.php|images|js|profile_pictures|fonts|stylesheets|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

RewriteCond %{HTTP_HOST} !^((www\.)?)example\.com [NC] 
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com
RewriteRule ^(.*)$ http://example.com/site/%1$1 [L,NC,P]

RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

Just to note, I'm also running CodeIgniter (if that matters).

Here is my loaded PHP modules (I'm thinking somewhere in here is the problem):

core mod_so mod_watchdog http_core mod_log_config mod_logio mod_version mod_unixd mod_access_compat mod_alias mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_host mod_authz_user mod_autoindex mod_deflate mod_dir mod_env mod_filter mod_mime prefork mod_negotiation mod_php5 mod_rewrite mod_setenvif mod_status
Community
  • 1
  • 1
user2983512
  • 73
  • 2
  • 11
  • what about your .htaccess file, do you have any – Brij Raj Singh - MSFT Jun 02 '14 at 13:47
  • You might have full access to the server, but does the account that Apache uses have access? – Sumurai8 Jun 02 '14 at 13:59
  • I think that may be the solution @Sumurai8, I'm using a standard root account? – user2983512 Jun 02 '14 at 14:00
  • http://serverfault.com/questions/125865/finding-out-what-user-apache-is-running-as - In general, Apache is not running as root, and neither should it. I am not 100% sure how to configure the rights for a particular account, but that's a suitable question for ServerFault if you need help with that. – Sumurai8 Jun 02 '14 at 14:02
  • Okay, to clarify, Apache is running as route. How do I tell Apache to run as another user? – user2983512 Jun 02 '14 at 14:11
  • Find your Apache main config file (httpd.conf or something similar). Find the `User` and `Group` directive. Change those, then stop, and start the Apache service/deamon. http://docs.oseems.com/general/application/apache/change-user-and-group – Sumurai8 Jun 02 '14 at 14:29
  • I've managed to change the user and Apache is now running under a user with full permissions, yet I'm still getting 403 :/ – user2983512 Jun 02 '14 at 14:36

0 Answers0