i got a signup verification script for my forum that shows images and asks the user to match it with the provided word it worked fine when i was using apache but today after i made the switch to nginx the images dont load anymore this script have an .htaccess file that contains: RewriteEngine on RewriteRule (.*) /show.php can someone please convert it to nginx rewrite? also i'm not sure if it matters but the full path to the .php file is /usr/share/nginx/html/forum another small problem i have is that if i get into http://mysite/forum it doesnt load the page,but if i add a secondary slash however as in /forum/ it works fine how can i fix it? thanks in advance
on 2009-01-15 20:53
on 2009-01-15 21:18
On Thu, Jan 15, 2009 at 08:53:55PM +0100, Lemon Head wrote: > to the .php file is /usr/share/nginx/html/forum > another small problem i have is that if i get into > http://mysite/forum it doesnt load the page,but if i add > a secondary slash however as in /forum/ it works fine > how can i fix it? thanks in advance Something like this: location /forum { fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/forum/show.php; include fastcgi_params; }
on 2009-01-15 22:41
Igor Sysoev wrote: > On Thu, Jan 15, 2009 at 08:53:55PM +0100, Lemon Head wrote: > >> to the .php file is /usr/share/nginx/html/forum >> another small problem i have is that if i get into >> http://mysite/forum it doesnt load the page,but if i add >> a secondary slash however as in /forum/ it works fine >> how can i fix it? thanks in advance > > Something like this: > > location /forum { > fastcgi_pass ...; > fastcgi_param SCRIPT_FILENAME > /usr/share/nginx/html/forum/show.php; > include fastcgi_params; > } first of,thx for your help i tried that but then nginx failed to start with this error: "Starting nginx: 2009/01/15 16:36:41 [emerg] 23287#0: location "/forum" is outside location "/forum/" in /etc/nginx/nginx.conf:121" heres my whole config , maybe it will help ####################################################################### # # This is the main Nginx configuration file. # # More information about the configuration options is available on # * the English wiki - http://wiki.codemongers.com/Main # * the Russian documentation - http://sysoev.ru/nginx/ # ####################################################################### #---------------------------------------------------------------------- # Main Module - directives that cover basic functionality # # http://wiki.codemongers.com/NginxMainModule # #---------------------------------------------------------------------- user nginx; worker_processes 5; error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; #---------------------------------------------------------------------- # Events Module # # http://wiki.codemongers.com/NginxEventsModule # #---------------------------------------------------------------------- events { worker_connections 1024; } #---------------------------------------------------------------------- # HTTP Core Module # # http://wiki.codemongers.com/NginxHttpCoreModule # #---------------------------------------------------------------------- http { include /etc/nginx/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 /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 2; gzip on; # Load config files from the /etc/nginx/conf.d directory include /etc/nginx/conf.d/*.conf; # # The default server # server { listen 80; server_name _; #charset koi8-r; #access_log logs/host.access.log main; location / { root /usr/share/nginx/html; index index.html index.php index.htm; } error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # vbseo rewrite location /forum/ { rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last; if (-f $request_filename) { expires 30d; break; } if ($request_filename ~ "\.php$" ) { rewrite ^(/forum/.*)$ /forum/vbseo.php last; } if (!-e $request_filename) { rewrite ^/forum/(.*)$ /forum/vbseo.php last; } location /forum { fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/forum/show.php; include fastcgi_params; } } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /usr/share/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$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; } } }
on 2009-01-16 13:23
On Thu, Jan 15, 2009 at 10:41:02PM +0100, Lemon Head wrote: > > > location "/forum" is outside location "/forum/" in > /etc/nginx/nginx.conf:121" If you properly format configuration: # vbseo rewrite location /forum/ { rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last; if (-f $request_filename) { expires 30d; break; } if ($request_filename ~ "\.php$" ) { rewrite ^(/forum/.*)$ /forum/vbseo.php last; } if (!-e $request_filename) { rewrite ^/forum/(.*)$ /forum/vbseo.php last; } location /forum { fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/forum/show.php; include fastcgi_params; } } then you will see that /forum is inside /forum/: location /forum/ { ... location /forum { You should use somethig like this: location = /forum { fastcgi_pass localhost:9000; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/forum/show.php; include fastcgi_params; } location ~ ^/forum/vbseo_sitemap/.+\.php$ { fastcgi_pass localhost:9000; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$uri; include fastcgi_params; } location ~ ^/forum/.+\.php$ { fastcgi_pass localhost:9000; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/forum/vbseo.php; include fastcgi_params; } location /forum/ { rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last; error_page 404 = /forum/vbseo.php; expires 30d; }
on 2009-01-16 18:52
for vbseo this is all i have for one of my clients:
location /forum/ {
rewrite
^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$
/forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
if ($request_filename ~ "\.php$") {
rewrite ^(.*)$ /forum/vbseo.php?vbseourl=$1
last;
}
if (!-e $request_filename) {
rewrite ^/forum/(.*)$
/forum/vbseo.php?vbseourl=$1 last;
}
}
site also has other things (blogs etc) that have their own location
blocks and it seems to all work great.
on 2009-01-16 20:25
On Fri, Jan 16, 2009 at 09:41:35AM -0800, mike wrote: > rewrite ^/forum/(.*)$ /forum/vbseo.php?vbseourl=$1 last; > } > } > > site also has other things (blogs etc) that have their own location > blocks and it seems to all work great. The right way: location /forum/ { error_page 404 = /forum/vbseo.php; } location ^~ /forum/urllist { rewrite ^/forum/(urllist.*\.(xml|txt)(\.gz)?)$ /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last; } location ^~ /forum/sitemap_ { rewrite ^/forum/(sitemap_.*\.(xml|txt)(\.gz)?)$ /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last; } location ~ ^/forum/.+\.php$ { fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME /path/to/forum/vbseo.php; fastcgi_param QUERY_STRING vbseourl=$request_uri; include fastcgi_params; } location = /forum/vbseo_sitemap/vbseo_getsitemap.php { fastcgi_pass ...; fastcgi_param SCRIPT_FILENAME /path/to/forum/vbseo_sitemap/vbseo_getsitemap.php; fastcgi_param QUERY_STRING $args; include fastcgi_params; }
on 2009-01-20 14:14
sorry for the late response guys had some busy days i still have some problems accessing the forum,if i access http://site/forum/ it redirects to http://site/index.php which shouldnt happen,if i access http://site/forum i get "Internet Explorer cannot display the webpage" but http://site/forum/index.php works fine,any suggestions?
on 2009-01-20 14:24
okay i fixed the /forum/ problem but not the other,why cant it work without an extra / ?
on 2009-01-20 14:30
On Tue, Jan 20, 2009 at 02:14:57PM +0100, Lemon Head wrote: > sorry for the late response guys had some busy days > i still have some problems accessing the forum,if i access > http://site/forum/ > it redirects to http://site/index.php which shouldnt happen,if i access > http://site/forum i get "Internet Explorer cannot display the webpage" > but http://site/forum/index.php works fine,any suggestions? What configuration do you use now ?
on 2009-01-20 14:35
i attached it , i gave up on the image verification and just set it back to vbulletin original captchta i'm using the vbseo rewrite rules from the following thread http://www.vbseo.com/f4/howto-nginx-23485/ they were posted by a person in the vbseo staff so thought theyll be fine
on 2009-01-20 15:32
On Tue, Jan 20, 2009 at 02:35:38PM +0100, Lemon Head wrote: > i attached it , i gave up on the image verification > and just set it back to vbulletin original captchta > i'm using the vbseo rewrite rules from the following thread > http://www.vbseo.com/f4/howto-nginx-23485/ they were posted > by a person in the vbseo staff so thought theyll be fine > > Attachments: > http://www.ruby-forum.com/attachment/3183/nginx.conf You should replace # vbseo rewrite location /forum/ { rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last; if ($request_filename ~ "\.php$" ) { rewrite ^(.*)$ /forum/vbseo.php last; } if (!-e $request_filename) { rewrite ^/forum/(.*)$ /forum/vbseo.php last; } } with location = /forum { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/forum/vbseo.php; include fastcgi_params; } location /forum/ { rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last; error_page 404 = /forum/vbseo.php; } location ~ ^/forum/vbseo_sitemap/.+\.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$uri; include fastcgi_params; } location ~ ^/forum/.+\.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/forum/vbseo.php; include fastcgi_params; }
on 2009-01-20 15:53
tried it but no dice http://site.com/forum leads to "page not found" http://site.com/forum/ redirects to http://site.com/index.php not sure it matters but inside the forum folder there are 2 index files,the standard vbulletin one and an .html one which redirects to http://site.com/forum/index.php , it redirected fine with my previous config but not after puting the suggested changes , also i just saw your topic about the new nginx version and i started to wonder what version i have on my vps,i installed it from the fedora packages so i wasnt sure,i checked and found out its the old stable one (0.6.34) , you think that if ill upgrade to the newest devlopment version it will sort it out? , thanks for all of your help
on 2009-01-20 16:52
On Tue, Jan 20, 2009 at 03:53:53PM +0100, Lemon Head wrote: > tried it but no dice > http://site.com/forum leads to "page not found" Does the file /usr/share/nginx/html/forum/vbseo.php exist ? > http://site.com/forum/ redirects to http://site.com/index.php > not sure it matters but inside the forum folder there are 2 index > files,the standard vbulletin one and an .html one which redirects to > http://site.com/forum/index.php , it redirected fine with my previous > config but not after puting Then you need to add fastcgi_index index.php; inside location /forum/ { rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last; error_page 404 = /forum/vbseo.php; } > the suggested changes , also i just saw your topic about the new nginx > version > and i started to wonder what version i have on my vps,i installed it > from the fedora packages so i wasnt sure,i checked and found out its the > old stable one (0.6.34) , you think that if ill upgrade to the newest > devlopment version it will sort it out? , thanks for all of your help No, this should work with 0.6.34.
on 2009-01-20 18:38
thanks again for your help i added it and it fixed the /forum/ but i still get "page not found" on /forum yep it exists and its chmodded to 644
on 2009-01-20 18:40
i think i figured it out,somethin must have gone wrong with the vbseo install cuz the vbseo_sitemap folder doesnt exist ill reinstall it in a bit and let you know
on 2009-01-20 23:00
On Tue, Jan 20, 2009 at 06:38:50PM +0100, Lemon Head wrote: > thanks again for your help > i added it and it fixed the /forum/ > but i still get "page not found" on /forum > yep it exists and its chmodded to 644 Are you able to see /forum/vbseo.php ?
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.