archieroques
Posts: 26
Joined: Sun Mar 16, 2014 8:13 pm

Apache2 virtual host file not there.

Sat May 28, 2016 5:02 pm

I have been following the RPF's tutorial on creating a LAMP server on my Raspberry Pi. I've almost finished, but I've hit a roadblock.

The tutorial says:
You'll also need to tell the virtual host serving the site to allow requests to be overwritten. Do this by editing the virtual host file (with root permissions): sudo nano /etc/apache2/sites-available/default; also, change the AllowOverride setting on line 11 (inside the <Directory /var/www/html/> block) from None to All. Save the file and then restart Apache with sudo service apache2 restart. Once it's restarted, refresh the page and it should load successfully. Now posts have URLs like /hello-world/ instead of /?p=123, and pages have URLs like /sample-page/ instead of /?page_id=2.
However, when I enter

Code: Select all

sudo nano /etc/apache2/sites-available/default
a blank file comes up. When I navigate to the directory and run

Code: Select all

ls
a file called 000-default.conf is shown. When I open this with nano however, none of the lines that the tutorial specifies are there.

What's gone wrong?

I'm using the latest Raspbian Jessie release, on a Raspberry Pi B 512mb, and the tutorial here: https://www.raspberrypi.org/learning/la ... worksheet/

Thanks for your help.

User avatar
rpdom
Posts: 17172
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Apache2 virtual host file not there.

Sat May 28, 2016 5:12 pm

Ok, looks like a mistake on that tutorial.

I think you need to change the AllowOverride line in this block of 000-default

Code: Select all

        <Directory />
                Options FollowSymLinks
                AllowOverride None
                Order Deny,Allow
                Deny from all
                Allow from 192.168.42.0/24
        </Directory>

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Apache2 virtual host file not there.

Sat May 28, 2016 5:15 pm

Your problem is the tutorial was written for Apache2 2.2 on Wheezy. Your Raspberry is running Apache2 2.4 on Jessie and the default installation materials are different. There's a default virtualhost defined in 000-default.conf and HTML moves to /var/www/html (from /var/www).

Code: Select all

root@beaufort:/etc/apache2/sites-available # ls
000-default.conf  default-ssl.conf
root@beaufort:/etc/apache2/sites-available # cd /var/www
root@beaufort:/var/www # ls
html
root@beaufort:/var/www #


That should get you heading in the right direction.

BTW, don't use "Allow from" blocks, they're a monster pain in the tail.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Networking and servers”