Nginx as a reverse proxy for Apache 2 under ISPConfig 3 - Debian Jessie

Discussion in 'Server Operation' started by j.kaspar, Jul 23, 2017.

  1. j.kaspar

    j.kaspar New Member

    I have a Debian 8 server with Apache 2 under ispconfig 3.1. My goal is to build a high performance enviroment for hosting prestashop website on HHVM, plus a few other "traditional" web sites. I want to use nginx as a reverse proxy, so I installed nginx and tried to configure it with help of a bunch of tutorials and manuals on the internet. However, I am not able to get it to function.

    Apache is listening on port 82. Nginx now has only one vhost and it's config file now looks like this:
    server {
    listen 80;
    server_name _;
    access_log /var/log/ispconfig/httpd/$host/access.log;
    location ~ \.php$ {
    resolver ipv6=off;
    proxy_redirect off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://$host:82;
    location / {
    root /var/www/$host/web;
    index index.php;
    location ~ /\.ht {
    deny all;
    I have several issues:

    No. 1
    I have a website testovaci-a.local running on HHVM, which worked fine on apache, but now it ends up on error 502. Nginx error.log says this:

    > [error] 46133#0: *1 testovaci-a.local could not be resolved (3: Host not found), client:, server: testovaci-a.local, request: "GET / HTTP/1.1", host: "testovaci-a.local"
    But in the OS, the name is resolved without any problem, can be pinged etc... If I change the resolver (keeping ipv6=off) to, which is my nameserver set in resolv.conf, nothing changes.

    No. 2
    [crit] 46133#0: *1 open() "/var/log/ispconfig/httpd/testovaci-a.local/access.log" failed (13: Permission denied) while logging request, client:, server: testovaci-a.local, request: "GET / HTTP/1.1", host: "testovaci-a.local"
    Nginx runs on the very same account (root) as the apache, but cannot access the ispconfig log. I don't understand why.

    No. 3
    I created a new site in ISPconfig, that now runs fine in apache, but through nginx ends up on different error - 403, and the log contains this:

    [error] 649#0: *12 directory index of "/var/www/testovaci-b.local/web/" is forbidden, client:, server: _, request: "GET / HTTP/1.1", host: "testovaci-b.local"
    still, same accounts for apache and the nginx... The issue with logging is also here.
    Could someone please point me some direction? I am lost now. Everything I tried failed. Thank you

Share This Page