开发者社区> 问答> 正文

nginx伪静态的不生效,无法自定义链接。

设置了伪静态,但不知道哪里有问题。wordpress无法自定义链接,只能固态链接。
请各位老师赐教一下,不知道是哪里出的问题。


nginx.conf文件如下



user  www www;
worker_processes  8;


error_log  /alidata/log/nginx/error.log crit;
pid        /alidata/server/nginx/logs/nginx.pid;


#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;


events
{
  use epoll;
  worker_connections 65535;
}




http {
        include       mime.types;
        default_type  application/octet-stream;


        #charset  gb2312;


        server_names_hash_bucket_size 128;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
        client_max_body_size 8m;


        sendfile on;
        tcp_nopush     on;


        keepalive_timeout 60;


        tcp_nodelay on;


        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 64k;
        fastcgi_buffers 4 64k;
        fastcgi_busy_buffers_size 128k;
        fastcgi_temp_file_write_size 128k;


        gzip on;
        gzip_min_length  1k;
        gzip_buffers     4 16k;
        gzip_http_version 1.0;
        gzip_comp_level 2;
        gzip_types       text/plain application/x-javascript text/css application/xml;
        gzip_vary on;
        #limit_zone  crawler  $binary_remote_addr  10m;
        log_format '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
        include /alidata/server/nginx/conf/vhosts/*.conf;
}




vhosts里分别是 phpwind.conf ​和 default.conf.bak​


phpwind.conf如下​
server {
        listen       80;
        server_name  localhost;
        index index.html index.htm index.php;
        root /alidata/www/wordpress;
        location ~ .*\.(php|php5)?$
        {
                #fastcgi_pass  unix:/tmp/php-cgi.sock;
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi.conf;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
                expires 30d;
        }
        location ~ .*\.(js|css)?$
        {
                expires 1h;
        }
        #伪静态规则
        include /alidata/server/nginx/conf/rewrite/wordpress.conf;
        access_log  /alidata/log/nginx/access/http.log;
}


default.conf.bak如下


server {
        listen       80;
        server_name  localhost;
        index index.html index.htm index.php;
        root /alidata/www/wordpress;
        location ~ .*\.(php|php5)?$
        {
                #fastcgi_pass  unix:/tmp/php-cgi.sock;
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi.conf;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
                expires 30d;
        }
        location ~ .*\.(js|css)?$
        {
                expires 1h;
        }
        #伪静态规则
        include /alidata/server/nginx/conf/rewrite/wordpress.conf;
        access_log  /alidata/log/nginx/access/default.log;
}



[font='sans serif', tahoma, verdana, helvetica]​

展开
收起
古德莫宁 2016-05-10 00:47:53 10074 0
3 条回答
写回答
取消 提交回答
  • 回 2楼我的中国的帖子
    你好,配置如下。


    可发布的时候显示的还是固定链接

    -------------------------

    回 4楼dongshan8的帖子
    我这就是自定义,自定义无效

    -------------------------

    回 6楼dongshan8的帖子
    你好,没有设置成功,设置了伪静态的位置,但是生成文章时的链接为固态链接规则中的默认规则。链接仍然无法自定义
    2016-05-10 17:18:24
    赞同 展开评论 打赏
  • R&S网络资深工程师 ,阿里云论坛官方版主,阿里云云计算ACP,春考教学网站长,IT技术晋级之路专辑作者
    回 楼主(古德莫宁) 的帖子
    截图你的连接那个的配置

    -------------------------

    不是吧  你确认保存了  感觉不大可能呀

    2016-05-10 13:01:33
    赞同 展开评论 打赏
  • 旺旺:nectar2。
    楼主您好,

    请问您的站点访问网址是什么?

    请问您想自定义成怎么样的静态化链接呢?

    请问您在 wordpress 后台设置的自定义链接是怎么样的呢?

    -------------------------

    回 3楼(古德莫宁) 的帖子
    您好,

    建议您是在 “wordpress 后台 --> 设置 --> 固定链接” 的配置页面里自定义固定链接的形式喔。

    -------------------------

    回 5楼(古德莫宁) 的帖子
    您好,

    现在看起来,好象您已经设置成功了。

    是吗?



    -------------------------

    回 7楼(古德莫宁) 的帖子
    您好,

    能否举具体的例子呢?

    您打算为每个不同的文章或页面自定义链接结构吗?
    2016-05-10 10:31:14
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
《Nginx 代理系统常用手册》 立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载