Question
nginx+apache = 502 error
hello
i have finished settupng my droplet with this article: https://digitalocean.com/community/articles/how-to-configure-nginx-as-a-front-end-proxy-for-apache, but after restarting their services i got 502 error - Bad Gateway.
netstat output:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 27867/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 5846/nginx
tcp 0 0 127.0.0.1:82 0.0.0.0:* LISTEN 5824/apache2
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 793/sshd
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 13573/php-fpm.conf)
tcp6 0 0 :::4949 :::* LISTEN 24573/munin-node
tcp6 0 0 :::22 :::* LISTEN 793/sshd
/etc/nginx/sites-enabled/myexamplesite config:
server {
listen 80;
root /var/www/;
index index.php index.html index.htm;
server_name myexamplesite.com;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
location ~ /\.ht {
deny all;
}
}
/etc/apache2/sites-enabled/myexamplesite config:
ServerAdmin webmaster@localhost
DocumentRoot /var/www
Options FollowSymLinks
AllowOverride None
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
what is wrong here? it seems that request passes nginx to apache but than something goes wrong
Add a comment
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×