lnmp二级目录伪静态问题
我在安装LNMP的时候,安装的时候用的域名ceshi.taogirl.com.cn;现在在/home/wwwroot/建立了一个文件夹wordpress,网站放在这个目录下面了,路径为/home/wwwroot/wordpress/,这个目录绑定的域名是www.banduo.com.cn;这个伪静态用的是banduo.conf;网站伪静态正常;现在又在wordpress文件夹下面建立了一个文件夹名字是go,目录是/home/wwwroot/wordpress/go/,在这个目录下面放了另一个网站程序。这里做伪静态应该怎么做呢。伪静态规则应该放在哪里呢。谢谢军哥解答一下。 和bandou.conf一个目录,go的伪静态要是二级目录的伪静态才行 军哥响应速度真快! 那军哥 我这个伪静态应该怎么弄才能让这个在go目录下面安装的网站 实现伪静态呢 能提供下步骤吗 已经伪静态的网站目录:/home/wwwroot/banduo/绑定的域名:www.banduo.com.cn伪静态不成功的网站目录:/home/wwwroot/banduo/go/ 域名还是:www.banduo.com.cn 这个伪静态规则设置步骤可以提供下吗
原帖由 licess 于 2012-11-28 10:16 发表 https://bbs.vpser.net/images/common/back.gif
和banduo.conf一个目录,go的伪静态要是二级目录的伪静态才行 修改你那个域名的虚拟主机配置文件,参考里面的include域名include 上go的伪静态 log_formatbanduo'$remote_addr - $remote_user [$time_local] $request '
'$status $body_bytes_sent $http_referer '
'$http_user_agent $http_x_forwarded_for';
server
{
listen 80;
server_name www.banduo.com.cn banduo.com.cn;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/banduo;
include banduo.conf;
include go.conf;
location ~ .*\.(php|php5)?$
{
try_files $uri =404;
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log/home/wwwlogs/banduo.logbanduo;
}
其中红色的是include的虚拟主机配置文件www.banduo.com.cn.conf; 这样配置后我进行了 /root/lnmp restart 然后进行了/usr/local/nginx/sbin/nginx -t 测试
结果提示:nginx: invalid number of arguments in "location" directive in /usr/local/nginx/conf/banduo.conf:1这个错误,这个是什么原因导致的呢
其中banduo.conf的配置代码如下:
location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
这个banduo.conf的代码配置和wordpress的伪静态代码配置一样的
如果我去掉www.banduo.com.cn.conf里面的include go.conf;这个代码的话/root/lnmp restart 然后进行/usr/local/nginx/sbin/nginx -t 测试,就不会出现错误提示
这个应该怎么修改虚拟主机配置文件呢?
谢谢军哥告诉下
原帖由 licess 于 2012-11-28 12:10 发表 https://bbs.vpser.net/images/common/back.gif
修改你那个域名的虚拟主机配置文件,参考里面的include域名include 上go的伪静态 顺便补充下 go.conf的伪静态规则:
location /
{
if (!-f $request_filename){
set $rule_0 1$rule_0;
}
if (!-d $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite ^/(+)/?$ /yourls-go.php?id=$1 last;
}
rewrite ^/(+)\+/?$ /yourls-infos.php?id=$1 last;
rewrite ^/(+)\+all/?$ /yourls-infos.php?id=$1&all=1 last;
} 二级目录的话,go伪静态应该如下:location /go/ {
if (!-f $request_filename){
set $rule_0 1$rule_0;
}
if (!-d $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite ^/go/(+)/?$ /go/yourls-go.php?id=$1 last;
}
rewrite ^/go/(+)\+/?$ /go/yourls-infos.php?id=$1 last;
rewrite ^/go/(+)\+all/?$ /go/yourls-infos.php?id=$1&all=1 last;
} 用了下面的代码放置在go.conf里面。在www.banduo.com.cn.conf里面include go.conf;
现在访问http://banduo.com.cn/go/taobao出现404 这个什么情况呢
原帖由 licess 于 2012-11-29 09:33 发表 https://bbs.vpser.net/images/common/back.gif
二级目录的话,go伪静态应该如下:
location /go/ {
if (!-f $request_filename){
set $rule_0 1$rule_0;
}
if (!-d $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite ^/go/( ... 重启过了没,有错误信息没? 重启过了 配置测试/usr/local/nginx/sbin/nginx -t 没有错误信息 打开http://banduo.com.cn/go/taobao 出现404
回复 12# 的帖子
那就只有可能是伪静态的问题了网上再找找这个程序的nginx的伪静态试试 这个我用二级域名的话伪静态是正常的,应该说明伪静态规则没有问题的。
原帖由 licess 于 2012-11-29 15:13 发表 https://bbs.vpser.net/images/common/back.gif
那就只有可能是伪静态的问题了
网上再找找这个程序的nginx的伪静态试试 军哥这个有方法解决吗
页:
[1]