nginx+apache = 502 error

February 26, 2014 1.6k views
hello i have finished settupng my droplet with this article:, 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* LISTEN 27867/mysqld tcp 0 0* LISTEN 5846/nginx tcp 0 0* LISTEN 5824/apache2 tcp 0 0* LISTEN 793/sshd tcp 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; 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; } 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 ::1/128 what is wrong here? it seems that request passes nginx to apache but than something goes wrong
2 Answers
try to restar php service
alternatively (is that a word?) try changin
try_files $uri $uri/ /index.php;
to try_files $uri /index.php?$args;
You are trying to reverse proxy requests to but I don't see anything listening on that port.
Have another answer? Share your knowledge.