0

Hi I've been trying to create a local web dev environment in my home folder. My local LAMP is running fine, and I tried this tutorial to develop without the hassle of the permissions in var/www http://ubuntuserverguide.com/2012/10/how-to-enable-and-configure-apache2-userdir-module-in-ubuntu-server-12-04.html

I'm getting a 403 forbidden error when trying to access it like so:

http://localhost/~asdf/

Please advise.

user126440
  • 167
  • 1
  • 2
  • 9

1 Answers1

0

technically the best place to put your web files is in /var/www//... But, if you create a virtual host in your machine and put some IP in /etc/hosts/ to point some "name". You can do that.

Virtual hosts:

cp -p /etc/apache/sites-avaliable/000-default.conf /etc/apache/sites-avaliable/myname.conf

sudo nano /etc/apache/sites-avaliable/myname.conf

edit the line:

serverName myname  

<Directory /var/www/myname/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

Save it, and run:

sudo a2ensite myname.conf  
sudo service apache2 reload  

Give some ip:

sudo nano /etc/hosts
127.0.0.1     myname

Save it and now go to browser:

http://myname/  

Now it's ok! :)

Jonathan
  • 48
  • 1
  • 1
  • 5
  • Thanks, that worked. I also found an in-depth tut on it here: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts Oh, and I think your 000-default.conf should be just "default". 000-default.conf is a link to default in sites-enabled. – user126440 Jul 10 '14 at 21:39
  • Yes, you are correcte. But depende on system... some is 000-default.conf and other may be is default. I'm glad i can help you out. – Jonathan Jul 10 '14 at 21:43