說(shuō)明: 通過(guò) brew 安裝的 nginx
網(wǎng)站根目錄: /opt/homebrew/var/www
nginx 配置目錄: /opt/homebrew/etc/nginx/
假設: 有項目名稱(chēng)為 TestProject , 域名為 bd.testproject.com
# 終端 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 默認配置文件中引入站點(diǎn)配置
# 終端 vim /opt/homebrew/etc/nginx/nginx.conf # 在文件內 http{} 中新增 server_names_hash_bucket_size 64; # 修改服務(wù)器名稱(chēng)長(cháng)度,只能為 32 的倍數 include /opt/homebrew/etc/nginx/vhosts/*; # 引入站點(diǎn)配置
# 終端 nginx -s reload
請忽略我, 啟動(dòng) fastcgi
/usr/local/php/bin/php-cgi -b 9000
到此這篇關(guān)于Mac M1 Nginx 配置多站點(diǎn)的實(shí)現的文章就介紹到這了,更多相關(guān)Mac M1 Nginx多站點(diǎn)內容請搜索腳本之家以前的文章或繼續瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自本網(wǎng)站內容采集于網(wǎng)絡(luò )互聯(lián)網(wǎng)轉載等其它媒體和分享為主,內容觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如侵犯了原作者的版權,請告知一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容,聯(lián)系我們QQ:712375056,同時(shí)歡迎投稿傳遞力量。
Copyright ? 2009-2022 56dr.com. All Rights Reserved. 特網(wǎng)科技 特網(wǎng)云 版權所有 特網(wǎng)科技 粵ICP備16109289號
域名注冊服務(wù)機構:阿里云計算有限公司(萬(wàn)網(wǎng)) 域名服務(wù)機構:煙臺帝思普網(wǎng)絡(luò )科技有限公司(DNSPod) CDN服務(wù):阿里云計算有限公司 百度云 中國互聯(lián)網(wǎng)舉報中心 增值電信業(yè)務(wù)經(jīng)營(yíng)許可證B2
建議您使用Chrome、Firefox、Edge、IE10及以上版本和360等主流瀏覽器瀏覽本網(wǎng)站