Nginx 配置二级虚拟目录访问 Laravel 后台重写
admin
2023-03-01 14:22:44
0

案例1
server {
listen 80;
listen 443 ssl http2;
server_name new.api.zentrust.cn;
root /var/www/new.api.zentrust.cn/prod/public;
index index.php index.html index.htm;
etag on;

gzip on;
gzip_vary on;
gzip_http_version 1.0;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 2;
gzip_disable msie6;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/xml+rss;

client_max_body_size 110m;
client_body_buffer_size 1024k;

keepalive_timeout   60;

sendfile on;
sendfile_max_chunk 512k;
tcp_nopush on;
tcp_nodelay on;

ssl_session_cache   shared:SSL:10m;
ssl_session_timeout 30m;
ssl_certificate /etc/nginx/ssl/new.api.zentrust.cn/fullchain.cer;
ssl_certificate_key /etc/nginx/ssl/new.api.zentrust.cn/privkey.key;

location ^~ /test {
    alias   /var/www/new.api.zentrust.cn/test/public;

    if (!-e $request_filename) {
            rewrite ^ /test/index.php last;
    }

    location ~ \.php$ {
            if (!-f $request_filename) {
                    return 404;
            }

            fastcgi_pass        unix:/tmp/php-fpm-72.sock;
            fastcgi_index       index.php;
            fastcgi_param       SCRIPT_FILENAME $request_filename;
            include             fastcgi_params;
    }
}

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
    fastcgi_pass        unix:/tmp/php-fpm-72.sock;
    fastcgi_index       index.php;
    fastcgi_param       SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include             fastcgi_params;
}

location = /robots.txt  { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }

}

案例2
server
{
listen 80;
server_name test.myfxdd.com;
index index.html index.htm index.php default.html;
root /var/www/DD/test/myfxdd/view;

   location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
    }
location / {
try_files $uri $uri/ /index.html;
}   
    location ~ .*\.(js|css)?$
    {
        expires      12h;
    }
    location @router {
        rewrite ^.*$ /index.html last;
    }

location /backend {
alias /var/www/DD/test/myfxdd/view/backend/public;
index index.html index.php;
try_files $uri $uri/ /index.php?$query_string;
if (!-e $request_filename) {
            rewrite ^ /backend/index.php last;
    }

location ~ \.php$ {
           if (!-f $request_filename) {
                    return 404;
            }

            fastcgi_pass         127.0.0.1:9000;
            fastcgi_index       index.php;
    fastcgi_param       SCRIPT_FILENAME $request_filename;
            include             fastcgi_params;
    }

location ~ \.php {
    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
    add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,lang,access-token';
    if ($request_method = 'OPTIONS') {
        return 204;
    }

    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_split_path_info       ^(.+\.php)(/.+)$;
    fastcgi_param PATH_INFO       $fastcgi_path_info;
    fastcgi_param PATH_TRANSLATED /var/www/DD/test/myfxdd/view/backend/public/$fastcgi_path_info;
    fastcgi_param SCRIPT_FILENAME /var/www/DD/test/myfxdd/view/backend/public/$fastcgi_script_name;
    include                       fastcgi_params;
}

    error_log  /usr/local/nginx/logs/error.dev.myfxdd.com.log;
access_log /usr/local/nginx/logs/access.dev.myfxdd.com.log;

}
}

相关内容

热门资讯

【第一消息】“山西扣点.究竟有... 您好:山西扣点这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9784099】很多玩家在这款游戏...
我来教教您“喜扣打筒子.到底有... 家人们!今天小编来为大家解答喜扣打筒子透视挂怎么安装这个问题咨询软件客服徽4282891的挂在哪里买...
【第一资讯】“天天快来麻将.怎... 家人们!今天小编来为大家解答天天快来麻将透视挂怎么安装这个问题咨询软件客服徽4282891的挂在哪里...
今日重大通报“笑傲江湖.怎么装... 网上科普关于“笑傲江湖有没有挂”话题很是火热,小编也是针对笑傲江湖作*弊开挂的方法以及开挂对应的知识...
【第一财经】“随意玩拼三张.辅... 网上科普关于“随意玩拼三张有没有挂”话题很是火热,小编也是针对随意玩拼三张作*弊开挂的方法以及开挂对...
最新引进“小猪对对碰.有挂吗?... 网上科普关于“小猪对对碰有没有挂”话题很是火热,小编也是针对小猪对对碰作*弊开挂的方法以及开挂对应的...
终于了解“大富豪.究竟有挂吗?... 终于了解“大富豪.究竟有挂吗?”其实是有挂您好,大富豪这个游戏其实有挂的,确实是有挂的,需要了解加客...
终于懂了“灯塔麻将.真的有挂吗... 您好:灯塔麻将这款游戏可以开挂,确实是有挂的,需要了解加客服微信【9784099】很多玩家在这款游戏...
我来教教您“兴动茶馆.到底有挂... 家人们!今天小编来为大家解答兴动茶馆透视挂怎么安装这个问题咨询软件客服徽4282891的挂在哪里买很...
终于明白“乐酷炸金花.开挂器?... 网上科普关于“乐酷炸金花有没有挂”话题很是火热,小编也是针对乐酷炸金花作*弊开挂的方法以及开挂对应的...