0

trying to install nginx with apache revers proxy, apache itself does sent to php-fpm to port 9000 on localhost

so apache http on port 8081, apache https 444

nginx 80 and nginx ssl 443

php-fpm port 9000

Via port http wordpress looks ok, if i open it via https looks like no css/js is passed through. Any suggestion?

image1 image2 image3 image4

Klevin Kona
  • 101
  • 2
  • 2
    Perhaps the script links are http, and your browser refuses to fetch them. Does your browser tell you the page is safe? BTW, why both nginx and apache? Use one or the other. – Gerard H. Pille Apr 28 '20 at 19:49
  • if You'll open inspector panel in browser and go to network tab, I'm sure You'll see certificate issue. Since self-signed certs not allowed by default. – num8er Apr 28 '20 at 22:40
  • Maybe https://serverfault.com/questions/450628/apache-2-4-php-fpm-proxypassmatch – M at Mar 04 '22 at 17:11

2 Answers2

0

Maybe you must set HTTP header like :

proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header Front-End-Https on;

Hope this will help you.

YonzLeon
  • 168
  • 5
0

Well you can use Apache -->> Nginx -->> PHP-FPM

#Apache
<VirtualHost *:8081>
    ServerName example.com
    ProxyPreserveHost On

    ProxyPass / http://127.0.0.1:80/
    ProxyPassReverse / http://127.0.0.1:80/
</VirtualHost>


#Nginx
server {   
    listen 80;
    root /var/www/;
    index index.php;
    location / {
        try_files $uri $uri/ /index.php?$query_string;
        # gzip_static on;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }
    
    error_page 404 /index.php;

    location ~ \.php$ {        
        fastcgi_pass php:9000;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

You also can go Apache -->>PHP-FPM (Docs)

<VirtualHost *:8081>
    ServerName example.com
    ProxyPreserveHost On
    ProxyPass / fcgi://127.0.0.1:9000/
    ProxyPassReverse / fcgi://127.0.0.1:9000/
</VirtualHost>
M at
  • 111
  • 3