Welcome! Log In Create A New Profile

Advanced

nginx при ЧПУ выдает на страницу скрипт в сыром виде.

January 24, 2015 06:26AM
Решил переехать с апача на нгинкс, все как бы не поблема, все работает, пока не дошло дело до ЧПУ. Вроде как бы и работает ЧПУ, ибо браузер то отдает страницу нужную, но загвоздка в том, что выдает в сыром виде, ни пхп, даже хтмл не обрабатывается в браузере и выдает все в сыром виде, как прописано в самом скрипте, с хтмл-тегами, и пхп-кодом.

Домен сайта условно назовем help.ru

Сам конфиг домена.

server {
listen 80;
server_name www.help.ru;
rewrite ^ http://help.ru$request_uri? permanent; #301 redirect
}
server {
listen 80;
server_name help.ru;
root /web/help/public_html/www;
index index.php;

#location / {
# try_files $uri $uri/ /error404.html;
#}



autoindex off;

location / {
if ($query_string ~ "^$"){
rewrite ^/index.php$ http://$http_host/ redirect;
}
if ($http_host ~* "^www.help\.ru$"){
rewrite .? http://help.ru$request_uri redirect;
}
if (!-e $request_filename){
rewrite ^/referat.html$ /wiev.php?cat=Реферат break;
}
if ($query_string ~* "(<|%3C).*script.*(>|%3E)"){
return 403;
}
if ($query_string ~ "GLOBALS(=|[|%[0-9A-Z]{0,2})"){
return 403;
}
if ($query_string ~ "_REQUEST(=|[|%[0-9A-Z]{0,2})"){
return 403;
}
}

location = /error404.html {
rewrite ^(.*)$ /error404.php break;
}

location = /referat.html {
rewrite ^(.*)$ /wiev.php?cat=Реферат break;
}

location = /kontrolnaya.html {
rewrite ^(.*)$ /wiev.php?cat=Контрольная break;
}

location = /kyrsovaya.html {
rewrite ^(.*)$ /wiev.php?cat=Курсовая break;
}

location = /search.html {
rewrite ^(.*)$ /search.php break;
}

location = /regulations.html {
rewrite ^(.*)$ /regulations.php break;
}

location = /contacts.html {
rewrite ^(.*)$ /contacts.php break;
}

location = /news.html {
rewrite ^(.*)$ /news.php break;
}

location = /input.html {
rewrite ^(.*)$ /input.php break;
}

location /sub_ {
rewrite ^/sub_([a-z]+).html$ /wievsub.php?sub=$1 break;
rewrite ^/sub_([a-z]+)([0-9]+).html?$ /wievsub.php?sub=$1&page=$2 break;
}

location /referat {
rewrite ^/referat([0-9]+).html?$ /wiev.php?cat=Реферат&page=$1 break;
rewrite ^/referat/([0-9]+).html?$ /wievjob.php?id=$1 break;
}

location /kontrolnaya {
rewrite ^/kontrolnaya([0-9]+).html?$ /wiev.php?cat=Контрольная&page=$1 break;
rewrite ^/kontrolnaya/([0-9]+).html?$ /wievjob.php?id=$1 break;
}

location /kyrsovaya {
rewrite ^/kyrsovaya([0-9]+).html?$ /wiev.php?cat=Курсовая&page=$1 break;
rewrite ^/kyrsovaya/([0-9]+).html?$ /wievjob.php?id=$1 break;
}

location = /downloadjob.html {
rewrite ^(.*)$ /downloadjob.php break;
}



location ~* ^.+.(js|css|png|jpg|jpeg|gif|ico)$ {
access_log off;
expires max;
}
location ~ \.php$ {
# fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;

fastcgi_param DOCUMENT_ROOT /help.ru;
fastcgi_param SCRIPT_FILENAME /help.ru$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED /help.ru$fastcgi_script_name;

include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
## Disable viewing .htaccess & .htpassword
location ~ /\.ht {
deny all;
}
}
Subject Author Posted

nginx при ЧПУ выдает на страницу скрипт в сыром виде.

Sollomon January 24, 2015 06:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 260
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