Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nginx configuration secondary virtual directory access Laravel background rewrite

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Case 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 against gzipmakers mingling length 1k against gzipmakers buffers 4 16k for gzipmakers compounding level 2 for gzipmakers 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 clientholders for bodybuffers size 1024kkeepalivetiming timeout 60 for sendfile on;sendfile_max_chunk 512k for tcpmakers nopush on;tcp_nodelay on;ssl_session_cache shared:SSL:10m Ssl_session_timeout 30m rewrite slated 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;}

}

Case 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 | 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 request_filename 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 OPTIONS' 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;}}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report