Welcome! Log In Create A New Profile


nginx reverse proxy & phpbb3

Posted by jeradj 
nginx reverse proxy & phpbb3
July 21, 2009 10:24PM
Hello again, I had a topic on this same subject a few posts down, but I can no longer access the post for some reason (attempts to do so takes me to a "502 bad gateway page", here is a link to that thread http://forum.nginx.org/read.php?11,4152 )

Anyway, what I had posted in that topic, is that I have set up an nginx reverse proxy on my home network for running multiple test websites on my internet connection.

The only site that I have up at the moment is a phpbb forum. The problem is that there is something wrong with the way the site is served when accessed from outside my local network, through the reverse proxy. If I go directly to the host while -inside- my network, the site works just fine -- outside the network, the site's css and functionality is broken.

You can look at the site here: http://forum.iseekthegrail.com/forum/

An example of what the site looks like inside the network: [img]http://i158.photobucket.com/albums/t102/daishantheinfant/example.png[/img]

In order to get this going, I just copied an example that I took from here: http://www.cmdln.org/2009/07/12/transparent_dynamic-reverse-proxy-with-nginx/

And finally, my nginx config file looks like this:


#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;

http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
#root html;
#index index.html index.htm;

proxy_pass http://$host$uri;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;

# proxy the PHP scripts to Apache listening on
#location ~ \.php$ {
# proxy_pass;

# pass the PHP scripts to FastCGI server listening on
#location ~ \.php$ {
# root html;
# fastcgi_pass;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#location ~ /\.ht {
# deny all;

# another virtual host using mix of IP-, name-, and port-based configuration
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }

# HTTPS server
#server {
# listen 443;
# server_name localhost;

# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_timeout 5m;

# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }



Anybody got any ideas? I greatly appreciate any and all ideas - thanks a lot!
Re: nginx reverse proxy & phpbb3
July 26, 2009 02:33PM
Well, I sorta kinda got this working, but probably not exactly as I would prefer it to work. I can get the forum to appear and work correctly by uncommenting and changing the following few lines.
# proxy the PHP scripts to Apache listening on

location ~ \.php$ {
proxy_pass http://forum.iseekthegrail.com;

Also, using: proxy_pass http://$host$uri; in this context does not work

This confuses me, because I thought that above, in the line: location / --- that that would match anything and everything, so I don't understand why having a separate match for php files is necessary.

Can anyone explain this to me?

Or point me to where in the docs I should be reading?

Thanks again
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 82
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready