felix001
felix001

Reputation: 16691

Apache with Alias and Proxy Match

I'm running a ghost website, that is being fronted by apache using a proxy within the vhost. However, I know have an additional folder I need to provide access to - icookie:

[root@gce ~]# ls -l /var/www/html/blog
total 252
-rw-r--r--.   1 apache apache   4511 Feb 27  2017 config.example.js
-rw-r--r--.   1 apache apache   4510 May  2 20:51 config.js
drwxr-xr-x.   6 apache apache   4096 Feb 27  2017 content
drwxr-xr-x.   5 apache apache   4096 Feb 27  2017 core
-rw-r--r--.   1 apache apache  31937 Feb 27  2017 Gruntfile.js
**drwxrwxr-x.   3 apache apache   4096 Oct 20 22:37 icookie <-------
-rw-r--r--.   1 apache apache    725 Feb 27  2017 index.js
-rw-r--r--.   1 apache apache   1065 Feb 27  2017 LICENSE
drwxr-xr-x. 109 apache apache   4096 Feb 27  2017 node_modules
-rw-r--r--.   1 apache apache 166948 Feb 27  2017 npm-shrinkwrap.json
-rw-r--r--.   1 apache apache   3047 Feb 27  2017 package.json
-rw-r--r--.   1 apache apache   2942 Feb 27  2017 PRIVACY.md
-rw-r--r--.   1 apache apache   4710 Feb 27  2017 README.md

However, on adding the following config to apache, Im still unable to access any files from within the icookie folder. From what I see the following should work.

<VirtualHost *:443>
    ServerName website.com
    ServerAlias direct.website.com www.website.com

    ProxyPass /icookie !
    Alias /icookie /var/www/html/blog/icookie
    <Directory /var/www/html/blog/icookie>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            Allow from all
    </Directory>

    ProxyPass / http://10.240.0.3:2369/
    ProxyPassReverse / http:/10.240.0.3:2369/

    ErrorLog #########
    CustomLog ######### common

    SSLEngine on
    SSLCertificateFile ############
    SSLCertificateKeyFile ########
</VirtualHost>

Any Ideas?

Upvotes: 3

Views: 375

Answers (1)

Chocolord
Chocolord

Reputation: 493

In the ProxyPassReverse directive the second argument is missing a / character between the protocol name and the IP address.

According to the apache documentation

if you are creating an Alias to a directory outside of your DocumentRoot, you may need to explicitly permit access to the target directory.

Alias "/image" "/ftp/pub/image"
<Directory "/ftp/pub/image">
    Require all granted
</Directory>

For your example you may need to add the Require directive like this:

<VirtualHost *:443>
    ServerName website.com
    ServerAlias direct.website.com www.website.com

    ProxyPass /icookie !
    Alias /icookie /var/www/html/blog/icookie
    <Directory /var/www/html/blog/icookie>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            Allow from all
            Require all granted
    </Directory>

    ProxyPass / http://10.240.0.3:2369/
    ProxyPassReverse / http://10.240.0.3:2369/

    ErrorLog #########
    CustomLog ######### common

    SSLEngine on
    SSLCertificateFile ############
    SSLCertificateKeyFile ########
</VirtualHost>

Upvotes: 1

Related Questions