0

I am having a problem with a test page I set up for my website. The config file (index.html) looks like this

<html>
<head>
<title>Welcome to website.net!</title>
</head>
<body>
<h1>Success! The website.net virtual host is working!</h1>
</body>
</html>

Which should display a page like this in my browser when I navigate to www.mywebsite.net

Welcome to website.net!

Success! The website.net virtual host is working!

However I get a 403 "forbidden" error when I navigate to the page. What am I missing? I have the directory installed on /var/www/mywebsite.net/public_html/index.html

I have the permissions of the /var/www directory set to 755 so that others can read and exicute it but it does not seem to be working. I also have port 80 open on my iptable. The server is a VPS server if that makes a difference however I have added a DNS record for the ip address.

Any help is appreciated!

UPDATE: Here is my virtual host configuration file "mywebsite.net.conf"

<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin webmaster@mywebsite.net
ServerName  www.mywebsite.net
ServerAlias mywebsite.net
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/myusername/public/mywebsite.net/public
# Log file locations
LogLevel warn
ErrorLog  /home/mysuername/public/mywebsite.net/log/error.log
CustomLog /home/myusername/public/mywebsite.net/log/access.log combined
<Directory /home/myusername/public/mywebsite.net/public>
Options Indexes ExecCGI Includes FollowSymLinks MultiViews
AllowOverride All
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
  • 2
    What are the ownership and permissions of "index.html" , where is it located, and what version of ubuntu / apache are you using ? the default location was recently changed from /var/www to /var/www/html – Panther May 29 '14 at 22:38
  • I am using apache 2.4.7(latest version). "index.html" is located at /var/www/mywebsite.net/public_html The permissions are :drwxr-xr-x 3 755 root 4096 – mrhatter May 29 '14 at 22:45
  • Try moving index.html to /var/www/html/. – saiarcot895 May 29 '14 at 22:58
  • This is a permissions problem. Check the permissions of the index.html file and all the parent directories. Also check your apache configuration and DocumentRoot – Panther May 29 '14 at 22:58
  • @saiarcot8as that would be a 404 error, file not found – Panther May 29 '14 at 22:59
0

Since your virtual host file has a .conf extension, then I guess you are using 13.04 or 14.04, or maybe you just updated apache to apache 2.4.

In your case, you need to remove the following two directives:

Order Deny,Allow
Allow from all

and replace them with the following directive

Require all granted

For a more detailed info, please look at my other answer which explains what needs to be changed after upgrading apache2.2 to apache2.4.

| improve this answer | |
  • Okay Thank you! That got rid of the 403 error but now it only displays a blank index. It gives me an "index of /" page but there are no sub directories to choose from. I tried adding my "index.html" do the document root and that finally worked correctly thank you!! Additionally yes I am using both Ubuntu 14.04 and apache 2.4.7 – mrhatter May 30 '14 at 17:41
0

if you want to run apache under your user

first edit /etc/apache2/envvars and look for

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

change www-data to your user, restart apache2 after that, let me know if it work

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.