日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

nginx 简单配置

發布時間:2023/12/20 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nginx 简单配置 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
https的配置方法 #這個是接口文檔的---------------------------------- server { #偵聽80端口 listen 80; #定義使用 www.nginx.cn訪問 server_name tapi.***.net;

?

rewrite ^(.*) https://$server_name$1 permanent; } #微信項目 https配置 server {

?

listen 443 ssl; server_name tapi.m***.net;

?

ssl_certificate /etc/nginx/ssl_key/2147197624dd932.pem; ssl_certificate_key /etc/nginx/ssl_key/2147197dd410932.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on;



#定義服務器的默認網站根目錄位置 root /usr/share/nginx/html/api/public; #設定本虛擬主機的訪問日志 # access_log logs/nginx.access.log main; #默認請求 location / { root /usr/share/nginx/html/api/public; index index.html index.htm index.php; #去除index.php用的 #方法1---- if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; break; }

?

#如果文件不存在則嘗試TP解析 (方法2) # try_files $uri /index.php$uri; } # 定義錯誤提示頁面 error_page 500 502 503 504 /50x.html; location = /50x.html { } # #靜態文件,nginx自己處理 # location ~ ^/(images|javascript|js|css|flash|media|static)/ { # #過期30天,靜態文件不怎么更新,過期可以設大一點, # #如果頻繁更新,則可以設置得小一點。 # expires 30d; # } #PHP 腳本請求全部轉發到 FastCGI處理. 使用FastCGI默認配置. location ~ \.php { root /usr/share/nginx/html/api/public; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;

?

# set $path_info ""; # set $real_script_name $fastcgi_script_name; # if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { # set $real_script_name $1; # set $path_info $2; # } # fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; # fastcgi_param SCRIPT_NAME $real_script_name; # fastcgi_param PATH_INFO $path_info;

?

fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; } #禁止訪問 .htxxx 文件 location ~ /.ht { deny all; } } 普通的80端口配置方法—————————— # #這個是接口文檔的---------------------------------- # server { # #偵聽80端口 # listen 80; # #定義使用 www.nginx.cn訪問 # server_name test.m***.net; # #定義服務器的默認網站根目錄位置 # root /usr/share/nginx/html/index/public; # #設定本虛擬主機的訪問日志 # # access_log logs/nginx.access.log main; # #默認請求 # location / { # root # /usr/share/nginx/html/index/public; # index # index.html index.htm index.php; # #去除index.php用的 # #方法1---- # if (!-e $request_filename) { # rewrite ^(.*)$ /index.php?s=/$1 last; # break; # }
# #如果文件不存在則嘗試TP解析 (方法2) # # try_files $uri /index.php$uri; # } # # 定義錯誤提示頁面 # error_page 500 502 503 504 /50x.html; # location = /50x.html { # } # # #靜態文件,nginx自己處理 # # location ~ ^/(images|javascript|js|css|flash|media|static)/ { # # #過期30天,靜態文件不怎么更新,過期可以設大一點, # # #如果頻繁更新,則可以設置得小一點。 # # expires 30d; # # } # #PHP 腳本請求全部轉發到 FastCGI處理. 使用FastCGI默認配置. # location ~ \.php { # root /usr/share/nginx/html/index/public; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # include fastcgi_params; # # set $path_info ""; # # set $real_script_name $fastcgi_script_name; # # if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { # # set $real_script_name $1; # # set $path_info $2; # # } # # fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; # # fastcgi_param SCRIPT_NAME $real_script_name; # # fastcgi_param PATH_INFO $path_info;
# fastcgi_split_path_info ^(.+\.php)(/.*)$; # fastcgi_param PATH_INFO $fastcgi_path_info; # } # #禁止訪問 .htxxx 文件 # location ~ /.ht { # deny all; # } # }

轉載于:https://www.cnblogs.com/cbywan/p/9128542.html

總結

以上是生活随笔為你收集整理的nginx 简单配置的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。