Welcome! Log In Create A New Profile

Advanced

Downloading

Posted by voodooKobra 
Downloading
September 21, 2011 10:56PM
Hi.

I'm not sure if I screwed up a configuration file somewhere, but if someone tries to access a garbage url such as /fsdkfsdkfkwdfjf without an extension, they get forced to a download for the source code (!!!!) of my error page.

Any ideas on where to start?

server {
listen 80;
server_name alpha7f.com www.alpha7f.com ssl.alpha7f.com;
#ROOT REMOVED
index index.php index.html index.htm;

location / {
try_files $uri $uri/ /index.php /index.html @catchall;
}
location ~ ^/(blog/|join/|forum/|membership/|about/|legal/) {
try_files $uri $uri/ /switch.php?req=$uri&$args;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_intercept_errors on;
}
location @catchall {
if ($request_filename ~* (%\/|\.html|\.jpg|\.png|\.css|\.txt|\.js)$ ) {
break;
}
return 444;
}
}

# HTTPS server
#
server {
listen 443;
server_name ssl.alpha7f.com;

#ROOT REMOVED
index index.php index.html index.htm;

ssl on;
# NOTE: SSL Stuff removed

ssl_session_timeout 5m;

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

location / {
try_files $uri $uri/ /index.php /index.html;
}
error_page 404 /error.php?e=404&uri=$uri&$args;
error_page 403 /error.php?e=404&uri=$uri&$args;

location ~ ^/(blog/|join/|forum/|membership/|about/|legal/|login/|account/) {
try_files $uri $uri/ /switch.php?req=$uri&$args;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_intercept_errors on;
include fastcgi_params;
}
}

server {
listen 80 default_server;
return 444;
}
Re: Downloading
September 21, 2011 11:01PM
Removing #default_type from the main .conf instead forces it to serve it as a .txt file

What can I do to get error pages to pass to fastCGI?
Re: Downloading
September 22, 2011 03:33AM
voodooKobra Wrote:
-------------------------------------------------------
> Removing #default_type from the main .conf instead
> forces it to serve it as a .txt file
>
> What can I do to get error pages to pass to
> fastCGI?

error_page 404 /your/error/page/script.php;
error_page 403 http://$server_name/your/error/page/script.php;

Andrejs
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 296
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready