Nginx服务动态php页面

时间:2019-05-31 14:08:32

标签: php nginx dynamic xhtml

我正在尝试将所有公司服务器都切换到nginx。到目前为止,除了我们像电子商务一样使用的网络门户外,其他一切都很好。

第一个问题是该门户网站是由外部公司(通信公司...)制作的,因此我并没有真正记录该体系结构。

Web门户的主页是一个可动态构建所有其他页面的php页面:切换时间很长,在每种情况下都有一个include pageN.php

示例...

case "logout":
include ("shop/logout.php");
exit;

现在出现了问题,当我单击注销(或所有其他按钮)时,传递的URL是xhtml(从www.site.com/index.php到www.site.com/aris.xhtml),并且nginx返回404。文件系统中不存在aris.xhtml,我认为它是自动生成的。

我测试了不同的配置,但是我可以得到的最佳结果是相同的索引页面,同时单击按钮(不提供任何页面,但没有404)。

有人可以向我解释这种类型的Web体系结构,或者向我指出文档吗?

预先感谢

.htaccess文件具有以下内容:

#####################################################
# Script: htaccess Security                 #
# Version: 1.0                                      # 
#####################################################

# No web server version and indexes
ServerSignature Off
Options -Indexes

# Enable rewrite engine
RewriteEngine On

# Exclude ipn
#RewriteRule ^(ipn)($|/) - [L]
RewriteRule ^ipn/.*$ - [PT]

# Block suspicious request methods
RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK|DEBUG) [NC]
RewriteRule ^(.*)$ - [F,L]

# Block WP timthumb hack
RewriteCond %{REQUEST_URI} (timthumb\.php|phpthumb\.php|thumb\.php|thumbs\.php) [NC]
RewriteRule . - [S=1]

# Block suspicious user agents and requests
RewriteCond %{HTTP_USER_AGENT} (libwww-perl|wget|python|nikto|curl|scan|java|winhttp|clshttp|loader) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (<|>|'|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (;|<|>|'|"|\)|\(|%0A|%0D|%22|%27|%28|%3C|%3E|%00).*(libwww-perl|wget|python|nikto|curl|scan|java|winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR]
RewriteCond %{THE_REQUEST} \?\ HTTP/ [NC,OR]
RewriteCond %{THE_REQUEST} \/\*\ HTTP/ [NC,OR]
RewriteCond %{THE_REQUEST} etc/passwd [NC,OR]
RewriteCond %{THE_REQUEST} cgi-bin [NC,OR]
RewriteCond %{THE_REQUEST} (%0A|%0D) [NC,OR]
# Block MySQL injections, RFI, base64, etc.
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC,OR]
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC,OR]
RewriteCond %{QUERY_STRING} (\.\./|\.\.) [OR]
RewriteCond %{QUERY_STRING} ftp\: [NC,OR]
RewriteCond %{QUERY_STRING} http\: [NC,OR]
RewriteCond %{QUERY_STRING} https\: [NC,OR]
RewriteCond %{QUERY_STRING} \=\|w\| [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)/self/(.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)cPath=http://(.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*iframe.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^i]*i)+frame.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [NC,OR]
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} ^.*(\[|\]|\(|\)|<|>).* [NC,OR]
RewriteCond %{QUERY_STRING} (NULL|OUTFILE|LOAD_FILE) [OR]
RewriteCond %{QUERY_STRING} (\./|\../|\.../)+(motd|etc|bin) [NC,OR]
RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR]
#RewriteCond %{QUERY_STRING} (<|>|'|%0A|%0D|%27|%3C|%3E|%00) [NC,OR]
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC,OR]
RewriteCond %{QUERY_STRING} (;|<|>|'|"|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|drop|delete|update|cast|create|char|convert|alter|declare|order|script|set|md5|benchmark|encode) [NC,OR]
RewriteCond %{QUERY_STRING} (sp_executesql) [NC]
RewriteRule ^(.*)$ - [F,L]

# Deny browser access to config files
#Order allow,deny
#Deny from all
#Allow from 1.2.3.4




<IfModule mod_rewrite.c>

RewriteEngine On
#RewriteCond %{SERVER_PORT} 80
#RewriteRule ^(.*)$ http://octo.web.site.it/$1 [R,L]
RewriteBase /

RewriteCond %{QUERY_STRING} ^(.*)$


#  cod + cat + cat2 + id
RewriteRule ^(.*)\/(.*)\/(.*)\/([0-9]*)_(.*).xhtml$ index.php?cod=$1&cat=$2&cat2=$3&id=$4&%1 [L,QSA]
RewriteRule ^(.*)\/(.*)\/(.*)\/(.*)_([0-9]*).xhtml$ index.php?cod=$1&cat=$2&cat2=$3&id=$5&%1 [L,QSA]
RewriteRule ^(.*)\/(.*)\/(.*)\/(.*).xhtml$ index.php?cod=$1&cat=$2&cat2=$3&id=$4&%1 [L,QSA]

#cod + cat + cat2
RewriteRule ^(.*)\/([0-9]*)_(.*)\/([0-9]*)_(.*).xhtml$ index.php?cod=$1&cat=$2&cat2=$4%1 [L,QSA]
RewriteRule ^(.*)\/(.*)_([0-9]*)\/(.*)_([0-9]*).xhtml$ index.php?cod=$1&cat=$3&cat2=$5%1 [L,QSA]
RewriteRule ^(.*)\/(.*)\/(.*).xhtml$ index.php?cod=$1&cat=$2&cat2=$3&%1 [L,QSA]

# cod + id
RewriteRule ^(.*)\/([0-9]*)_(.*).xhtml$ index.php?cod=$1&id=$2&%1 [L,QSA]
RewriteRule ^(.*)\/(.*)_([0-9]*).xhtml$ index.php?cod=$1&id=$3&%1 [L,QSA]
RewriteRule ^(.*)\/(.*).xhtml$ index.php?cod=$1&id=$2&%1 [L,QSA]


# solo cod
RewriteRule ^(.*)_(.*).xhtml$ index.php?cod=$1&%1 [L,QSA]
RewriteRule ^(.*).xhtml$ index.php?cod=$1&%1 [L,QSA]
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

0 个答案:

没有答案