请选择 进入手机版 | 继续访问电脑版
查看: 36|回复: 1

Playtube Nginx 规则,不隐藏/index.php 内页正常,首页打不开

[复制链接]

7

主题

149

帖子

317

积分

中级会员

Rank: 3Rank: 3

积分
317
发表于 2018-6-1 04:43:23 | 显示全部楼层 |阅读模式
真是怪了..内页是正常的. 首页就打不开,
刚开始 以为是套了CF CDN 的问题.后来把CF 解析关了.
源站还是首页打不开.
OneinStack LNMP  openrestry
[ol]
  • #Playtube Nginx
  • server {
  •   listen 80;
  •   listen 443 ssl http2;
  •   ssl_certificate /usr/local/openresty/nginx/conf/ssl/mcrss.com.crt;
  •   ssl_certificate_key /usr/local/openresty/nginx/conf/ssl/mcrss.com.key;
  •   ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  •   ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
  •   ssl_prefer_server_ciphers on;
  •   ssl_session_timeout 10m;
  •   ssl_session_cache builtin:1000 shared:SSL:10m;
  •   ssl_buffer_size 1400;
  •   add_header Strict-Transport-Security max-age=15768000;
  •   ssl_stapling on;
  •   ssl_stapling_verify on;
  •   server_name mcrss.com *.mcrss.com;
  •   access_log off;
  •   index index.html index.htm index.php;
  •   root /data/wwwroot/mcrss.com;
  •   if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
  •   if ($host != mcrss.com) {  return 301 $scheme://mcrss.com$request_uri;  }
  •   include /usr/local/openresty/nginx/conf/rewrite/playtube.conf;
  •   #error_page 404 /404.html;
  •   #error_page 502 /502.html;
  •   location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)$ {
  •     valid_referers none blocked *.mcrss.com mcrss.com;
  •     if ($invalid_referer) {
  •         return 403;
  •     }
  •   }
  •   location ~ [^/]\.php(/|$) {
  •     #fastcgi_pass remote_php_ip:9000;
  •     fastcgi_pass unix:/dev/shm/php-cgi.sock;
  •     fastcgi_index index.php;
  •     include fastcgi.conf;
  •   }
  •   location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
  •     expires 30d;
  •     access_log off;
  •   }
  •   location ~ .*\.(js|css)?$ {
  •     expires 7d;
  •     access_log off;
  •   }
  •   location ~ /\.ht {
  •     deny all;
  •   }
  • }
  • [/ol]复制代码
    ############## 修改官方的 playtube nginx 引用 playtube.conf ###############
    [ol]
  • 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 ^/$ /index.php?link1=home ;
  • }
  • rewrite ^/reset-password/([^/]+)(/|)$ /index.php?link1=reset-password&code=$1 ;
  • rewrite ^/confirm/(.*)/(.*)$ /index.php?link1=confirm&code=$1&email=$2 ;
  • rewrite ^/api/v(([0-9])([.][0-9]+))(/|)$ /api.php?v=$1 ;
  • rewrite ^/admin-cp$ /admincp.php ;
  • rewrite ^/admin-cp/(.*)$ /admincp.php?page=$1 ;
  • rewrite ^/admin-cdn/(.*)$ /admin-panel/$1 last;
  • rewrite ^/videos/category/(.*)/rss(/|)$ /index.php?link1=videos&page=category&id=$1&feed=rss ;
  • rewrite ^/videos/category/(.*)$ /index.php?link1=videos&page=category&id=$1 ;
  • rewrite ^/videos/(.*)/rss(/|)$ /index.php?link1=videos&page=$1&feed=rss ;
  • rewrite ^/videos/(.*)$ /index.php?link1=videos&page=$1 ;
  • rewrite ^/articles(/|)$ /index.php?link1=articles ;
  • rewrite ^/articles/category/(.*)$ /index.php?link1=articles&category_id=$1 ;
  • rewrite ^/articles/read/(.*)$ /index.php?link1=read&id=$1 ;
  • if (!-f $request_filename){
  •         set $rule_14 1$rule_14;
  • }
  • if (!-d $request_filename){
  •         set $rule_14 2$rule_14;
  • }
  • if ($rule_14 = "21"){
  •         rewrite ^/aj/([^/.]+)/?$ /ajax.php?type=$1&first=$2 last;
  • }
  • rewrite ^/aj/([^/.]+)/([^/.]+)/?$ /ajax.php?type=$1&first=$2 last;
  • rewrite ^/aj/([^/.]+)/([^/.]+)/([^/.]+)/?$ /ajax.php?type=$1&first=$2&second=$3 last;
  • rewrite ^/edit-video/(.*)?$ /index.php?link1=edit-video&id=$1 last;
  • rewrite ^/watch/([^/]+)(/|)?$ /index.php?link1=watch&id=$1 last;
  • rewrite ^/watch/([^/]+)/list/([^/]+)(/|)?$ /index.php?link1=watch&id=$1&list=$2 last;
  • rewrite ^/embed/(.*)?$ /index.php?link1=embed&id=$1 last;
  • rewrite ^/resend/(.*)/(.*)?$ /index.php?link1=resend&id=$1&u_id=$2 last;
  • rewrite ^/redirect/(.*)?$ /index.php?link1=redirect&id=$1 last;
  • rewrite ^/settings/(.*)/(.*)$ /index.php?link1=settings&page=$1&user=$2 ;
  • rewrite ^/settings/(.*)$ /index.php?link1=settings&page=$1 ;
  • rewrite ^/terms/([^/]+)(/|)$ /index.php?link1=terms&type=$1 ;
  • rewrite ^/go_pro(/|)$ /index.php?link1=go_pro ;
  • rewrite ^/ads(/|)$ /index.php?link1=ads ;
  • rewrite ^/ads/create(/|)$ /index.php?link1=create_ads ;
  • rewrite ^/ads/edit/(d+)(/|)$ /index.php?link1=edit_ads&id=$1 ;
  • rewrite ^/contact-us(/|)$ /index.php?link1=contact ;
  • rewrite ^/@([^/]+)(/|)$ /index.php?link1=timeline&id=$1 ;
  • rewrite ^/messages/(.*)$ /index.php?link1=messages&id=$1 ;
  • if (!-f $request_filename){
  •         set $rule_33 1$rule_33;
  • }
  • if (!-d $request_filename){
  •         set $rule_33 2$rule_33;
  • }
  • if ($rule_33 = "21"){
  •         rewrite ^/([^/]+)(/|)$ /index.php?link1=$1 ;
  • }
  • [/ol]复制代码
    ########### 下面这个是 官方给的NGINX 规则 ##############
    [ol]
  • # nginx configuration
  • location / {
  •   if (!-e $request_filename){
  •     rewrite ^/$ /index.php?link1=home;
  •   }
  •   if (!-e $request_filename){
  •     rewrite ^/aj/([^/.]+)/?$ /ajax.php?type=$1&first=$2;
  •   }
  •   rewrite ^/@([^\/]+)(\/|)$ /index.php?link1=timeline&id=$1;
  •   if (!-e $request_filename){
  •     rewrite ^/([^\/]+)(\/|)$ /index.php?link1=$1;
  •   }
  • }
  • location /reset {
  •   rewrite ^/reset-password/([^\/]+)(\/|)$ /index.php?link1=reset-password&code=$1;
  • }
  • location /confirm {
  •   rewrite ^/confirm/(.*)/(.*)$ /index.php?link1=confirm&code=$1&email=$2;
  • }
  • location /api {
  •   rewrite ^/api/v(([0-9])([.][0-9]+))(\/|)$ /api.php?v=$1;
  • }
  • location /admin {
  •   rewrite ^/admin-cp$ /admincp.php;
  •   rewrite ^/admin-cp/(.*)$ /admincp.php?page=$1;
  • }
  • location /admin-cdn/ {
  •   alias /admin-panel/;
  • }
  • location /videos {
  •   rewrite ^/videos/category/(.*)/rss(\/|)$ /index.php?link1=videos&page=category&id=$1&feed=rss;
  •   rewrite ^/videos/category/(.*)$ /index.php?link1=videos&page=category&id=$1;
  •   rewrite ^/videos/(.*)/rss(\/|)$ /index.php?link1=videos&page=$1&feed=rss;
  •   rewrite ^/videos/(.*)$ /index.php?link1=videos&page=$1;
  • }
  • location /articles {
  •   rewrite ^/articles(\/|)$ /index.php?link1=articles;
  •   rewrite ^/articles/category/(\d+)(\/|)$ /index.php?link1=articles&category_id=$1;
  •   rewrite ^/articles/read/(.*)(\/|)$ /index.php?link1=read&id=$1;
  • }
  • location /aj {
  •   rewrite ^/aj/([^/.]+)/([^/.]+)/?$ /ajax.php?type=$1&first=$2;
  •   rewrite ^/aj/([^/.]+)/([^/.]+)/([^/.]+)/?$ /ajax.php?type=$1&first=$2&second=$3;
  • }
  • location /edit {
  •   rewrite ^/edit-video/(.*)?$ /index.php?link1=edit-video&id=$1;
  • }
  • location /watch {
  •   rewrite ^/watch/([^\/]+)(\/|)?$ /index.php?link1=watch&id=$1;
  •   rewrite ^/watch/([^\/]+)/list/([^\/]+)(\/|)?$ /index.php?link1=watch&id=$1&list=$2;
  • }
  • location /embed {
  •   rewrite ^/embed/(.*)?$ /index.php?link1=embed&id=$1;
  • }
  • location /resend {
  •   rewrite ^/resend/(.*)/(.*)?$ /index.php?link1=resend&id=$1&u_id=$2;
  • }
  • location /redirect {
  •   rewrite ^/redirect/(.*)?$ /index.php?link1=redirect&id=$1;
  • }
  • location /settings {
  •   rewrite ^/settings/(.*)/(.*)$ /index.php?link1=settings&page=$1&user=$2;
  •   rewrite ^/settings/(.*)$ /index.php?link1=settings&page=$1;
  • }
  • location /terms {
  •   rewrite ^/terms/([^\/]+)(\/|)$ /index.php?link1=terms&type=$1;
  • }
  • location /go_pro {
  •   rewrite ^/go_pro(\/|)$ /index.php?link1=go_pro;
  • }
  • location /ads {
  •   rewrite ^/ads(\/|)$ /index.php?link1=ads;
  •   rewrite ^/ads/create(\/|)$ /index.php?link1=create_ads;
  •   rewrite ^/ads/edit/(\d+)(\/|)$ /index.php?link1=edit_ads&id=$1;
  • }
  • location /contact {
  •   rewrite ^/contact-us(\/|)$ /index.php?link1=contact;
  • }
  • [/ol]复制代码
    使用这上面的2个都不行.. 首页打 不开.
  • 回复

    使用道具 举报

    1

    主题

    24

    帖子

    55

    积分

    注册会员

    Rank: 2

    积分
    55
    发表于 2018-6-11 02:43:42 | 显示全部楼层
    [ol]
  • 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 ^/$ /index.php?link1=home ;
  • }
  • rewrite ^/$ /index.php?link1=home ;
  • rewrite ^/reset-password/([^/]+)(/|)$ /index.php?link1=reset-password&code=$1 ;
  • rewrite ^/confirm/(.*)/(.*)$ /index.php?link1=confirm&code=$1&email=$2 ;
  • rewrite ^/api/v(([0-9])([.][0-9]+))(/|)$ /api.php?v=$1 ;
  • rewrite ^/admin-cp$ /admincp.php ;
  • rewrite ^/admin-cp/(.*)$ /admincp.php?page=$1 ;
  • rewrite ^/admin-cdn/(.*)$ /admin-panel/$1 last;
  • rewrite ^/videos/category/(.*)/rss(/|)$ /index.php?link1=videos&page=category&id=$1&feed=rss ;
  • rewrite ^/videos/category/(.*)$ /index.php?link1=videos&page=category&id=$1 ;
  • rewrite ^/videos/(.*)/rss(/|)$ /index.php?link1=videos&page=$1&feed=rss ;
  • rewrite ^/videos/(.*)$ /index.php?link1=videos&page=$1 ;
  • rewrite ^/articles(/|)$ /index.php?link1=articles ;
  • rewrite ^/articles/category/(.*)$ /index.php?link1=articles&category_id=$1 ;
  • rewrite ^/articles/read/(.*)$ /index.php?link1=read&id=$1 ;
  • if (!-f $request_filename){
  •     set $rule_14 1$rule_14;
  • }
  • if (!-d $request_filename){
  •     set $rule_14 2$rule_14;
  • }
  • if ($rule_14 = "21"){
  •     rewrite ^/aj/([^/.]+)/?$ /ajax.php?type=$1&first=$2 last;
  • }
  • rewrite ^/aj/([^/.]+)/([^/.]+)/?$ /ajax.php?type=$1&first=$2 last;
  • rewrite ^/aj/([^/.]+)/([^/.]+)/([^/.]+)/?$ /ajax.php?type=$1&first=$2&second=$3 last;
  • rewrite ^/edit-video/(.*)?$ /index.php?link1=edit-video&id=$1 last;
  • rewrite ^/watch/([^/]+)(/|)?$ /index.php?link1=watch&id=$1 last;
  • rewrite ^/watch/([^/]+)/list/([^/]+)(/|)?$ /index.php?link1=watch&id=$1&list=$2 last;
  • rewrite ^/embed/(.*)?$ /index.php?link1=embed&id=$1 last;
  • rewrite ^/resend/(.*)/(.*)?$ /index.php?link1=resend&id=$1&u_id=$2 last;
  • rewrite ^/redirect/(.*)?$ /index.php?link1=redirect&id=$1 last;
  • rewrite ^/settings/(.*)/(.*)$ /index.php?link1=settings&page=$1&user=$2 ;
  • rewrite ^/settings/(.*)$ /index.php?link1=settings&page=$1 ;
  • rewrite ^/terms/([^/]+)(/|)$ /index.php?link1=terms&type=$1 ;
  • rewrite ^/go_pro(/|)$ /index.php?link1=go_pro ;
  • rewrite ^/ads(/|)$ /index.php?link1=ads ;
  • rewrite ^/ads/create(/|)$ /index.php?link1=create_ads ;
  • rewrite ^/ads/edit/(d+)(/|)$ /index.php?link1=edit_ads&id=$1 ;
  • rewrite ^/contact-us(/|)$ /index.php?link1=contact ;
  • rewrite ^/@([^/]+)(/|)$ /index.php?link1=timeline&id=$1 ;
  • rewrite ^/messages/(.*)$ /index.php?link1=messages&id=$1 ;
  • if (!-f $request_filename){
  •     set $rule_33 1$rule_33;
  • }
  • if (!-d $request_filename){
  •     set $rule_33 2$rule_33;
  • }
  • if ($rule_33 = "21"){
  •     rewrite ^/([^/]+)(/|)$ /index.php?link1=$1 ;
  • }[/ol]复制代码
  • 回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    Archiver|手机版|小黑屋| 主机之家 |网站地图

    返回顶部