主頁 > 知識庫 > Mac M1 Nginx 配置多站點的實現

Mac M1 Nginx 配置多站點的實現

熱門標簽:上海申請高400開頭的電話 怎么找到沒有地圖標注的店 打400電話怎么辦理收費 10086外包用的什么外呼系統 宿城區(qū)電話機器人找哪家 麗江真人語音電話外呼系統 河南防封號電銷機器人是什么 400電話辦理介紹信 福州企業(yè)電銷機器人排名

說明: 通過 brew 安裝的 nginx

網站根目錄: /opt/homebrew/var/www

nginx 配置目錄: /opt/homebrew/etc/nginx/

假設: 有項目名稱為 TestProject , 域名為 bd.testproject.com

第一步 : 設置 IP 與 域名 映射 (也就是增加 hosts)

# 終端
vim /etc/hosts 
 
# 增加保存
127.0.0.1  bd.testproject.com

 第二步 : 新建站點配置文件目錄

# 終端
mkdir /opt/homebrew/etc/nginx/vhosts

第三步 : 新建站點配置文件

在 /opt/homebrew/etc/nginx/vhosts 目錄中新建名為 bd.testproject.com_80.conf 配置文件 , 配置文件內容為(可根據自需更改配置內容):

server {
    listen    80;
    server_name bd.testproject.com;
    root  "/opt/homebrew/var/www/bd.testproject.com";
    location / {
      index index.php index.html error/index.html;
 
      autoindex off;
    }
    location ~ \.php(.*)$ {
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param PATH_INFO $fastcgi_path_info;
      fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
      include    fastcgi_params;
    }
}

第四步 : 在 nginx 默認配置文件中引入站點配置

# 終端
vim /opt/homebrew/etc/nginx/nginx.conf
 
# 在文件內 http{} 中新增
server_names_hash_bucket_size 64; # 修改服務器名稱長度,只能為 32 的倍數
include /opt/homebrew/etc/nginx/vhosts/*; # 引入站點配置

第五步 : 重啟 nginx

# 終端
nginx -s reload

請忽略我, 啟動 fastcgi

/usr/local/php/bin/php-cgi -b 9000

到此這篇關于Mac M1 Nginx 配置多站點的實現的文章就介紹到這了,更多相關Mac M1 Nginx多站點內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

標簽:連云港 隴南 面試通知 荊門 運城 遵義 雞西 朝陽

巨人網絡通訊聲明:本文標題《Mac M1 Nginx 配置多站點的實現》,本文關鍵詞  Mac,Nginx,配置,多,站點,的,;如發(fā)現本文內容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《Mac M1 Nginx 配置多站點的實現》相關的同類信息!
  • 本頁收集關于Mac M1 Nginx 配置多站點的實現的相關信息資訊供網民參考!
  • 推薦文章