You are not logged in.

#1 2018-10-01 17:23:15

schwim
Member
From: Western NC, US
Registered: 2015-09-29
Posts: 167
Website

[SOLVED] Apache2 not wanting to point to newly edited file location

Hi there everyone!

My default apache2 points to /var/www/html and I'd like to point it towards /home/schwim/www/public_html

So I backed up /etc/apache2/sites-available/000-default.conf and edited to reflect the change:

<VirtualHost *:80>
    ServerAdmin email@domain.com
    ServerName domain.com
    ServerAlias www.domain.com
    DocumentRoot /home/schwim/www/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Saved the file and restarted apache2 But now all the page requests are refused except for phpMyAdmin.

Forbidden
You don't have permission to access / on this server.
Apache/2.4.25 (Debian) Server at xxx.xxx.xxx.xxx Port 80


Here's my old .conf:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

If I visit my phpMyAdmin install, via domain.com/phpmyadmin, this resolves correctly.  That seems to have been setup during the lamp stack install and I can't seem to figure out why that works but my root directory won't.

Can someone tell me what I need to do to get apache to point the default connection to /home/schwim/www/public_html?

Thanks for your time!

Last edited by schwim (2018-10-01 21:11:27)


Schw.im! A social site with an identity crisis.

Offline

#2 2018-10-01 21:10:41

schwim
Member
From: Western NC, US
Registered: 2015-09-29
Posts: 167
Website

Re: [SOLVED] Apache2 not wanting to point to newly edited file location

It seems it was a permissions problem. I found some additional snippets that got it working:

<VirtualHost *:80>
        ServerAdmin xxx
        ServerName xxx
        ServerAlias xxx
        DocumentRoot /home/schwim/www/public_html

        <Directory "/home/schwim/www/public_html">
                Order allow,deny
                Allow from all
                Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Last edited by schwim (2018-10-01 21:11:06)


Schw.im! A social site with an identity crisis.

Offline

#3 2018-10-02 00:06:34

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 4,548
Website

Re: [SOLVED] Apache2 not wanting to point to newly edited file location

Just yesterday I was setting up a local virtual host, and hitting the changes between Apache 2.2 (Jessie) and 2.4 (Stretch). It took an hour or so...

I don't think you need the

    Order allow,deny
    Allow from all

section any more in fact, just the 'Require all granted'.
https://httpd.apache.org/docs/2.4/upgrading.html

If you want local access only, you can make that

Require local

in fact.

I prefer to leave sites-available/000-default.conf alone, and add a new site: sites-available/newhost.conf then enable it with 'sudo a2ensite newhost'. (Make sure newhost is in /etc/hosts.)

Not that I'm an Apache expert or anything.


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

Board footer

Powered by FluxBB