我的Mac os x中的nginx配置檔案nginx.conf
環境: Mac os x 10.10.3 + xcode6.3
在mac下用brew install nginx安裝好了nginx,增加對php的支援,完整的nginx.conf檔案內容如下:
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } include servers/*;
最關鍵的部分為:
另外一個非常重要的是:若在root目錄下添加了檔案或目錄,請保證一定有讀和執行的許可權,若要可寫,則還需設定寫許可權。
相關推薦
我的Mac os x中的nginx配置檔案nginx.conf
環境: Mac os x 10.10.3 + xcode6.3 在mac下用brew install nginx安裝好了nginx,增加對php的支援,完整的nginx.conf檔案內容如下: #user nobody; worker_processes 1; #er
如何在Mac OS X中開啟或關閉顯示隱藏檔案命令
開啟終端,輸入: defaults write com.apple.finder AppleShowAllFiles -booltrue此命令顯示隱藏檔案 defaults write com.app
Mac OS X中配置Apache
我使用的Mac OS X版本是10.8.2,Mac自帶了Apache環境。 啟動Apache設定虛擬主機 啟動Apache 開啟“終端(terminal)”,輸入 sudo apachectl -v,(可能需要輸入機器祕密)。如下顯示Apache的版本 接著輸入
Mac OS X中配置Apache HTTP伺服器
我現在正在使用的是Mac OS X版本是10.11.6,剛換了Mac os系統,對於用習慣了windows的來說確實需要一段時間適應,昨天在mac上配置環境的時候搭建apache http伺服器遇到了些問題現在總結分享一下,希望也能解決你們的煩惱。 一、啟動伺服器 首先開
在Mac OS X中下載Android源代碼的一些經驗
總結 同步 uil 空白 googl 新版 -h 教程 files 首先說明。隨著最近(2014年6月開始)GFW的升級。這個站點:http://www.android.com/ 已經不能正常訪問了,以下的這些操作均是在我連接VPN的時候進行的。 首先,須要做一些準
Mac OS X中Launchpad的圖標添加刪除方法(添加方法別試了,和Linux很大區別)
com nsh usr folders 單純 ron bsp blank 結構 說明:在Mac下的Launchpad圖標添加和刪除都與應用程序的app文件有關,如果單純的只想在Launchpad添加自定義的圖標,然後指定要某條命令運行時,建議不要這麽幹,Launchpad的
python matplotlib在mac os x 中如何顯示中文,完美解決
新的 com sub ttf 一行 lan HR tar spa 一、 下載相關的中文字體 simhei 文件: 下載地址 二、通過以下代碼查找matplotlib的數據存放位置: import matplotlib print(matplotlib.matplotlib
Mac OS X下安裝配置Android原始碼開發環境
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
在 Mac OS X 中怎樣獲取當前資料夾的路徑?
開啟終端,輸入下面的命令: defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES 就能在頂部看見完整的地址了 在Finder頂端的位址列右鍵,還可以直接訪問路徑中的任意
python matplotlib在mac os x 中如何顯示中文
一、 下載相關的中文字型 simhei 檔案: 下載地址 二、通過以下程式碼查詢matplotlib的資料存放位置: import matplotlib print(matplotlib.matplotlib_fname()) 我的目錄為: /Library/Fra
使用 lsof 代替 Mac OS X 中的 netstat 檢視佔用埠的程式
在 linux 裡可以使用 netstat -tulpn | grep LISTON 來看所有listen 的 port. Mac OS 只有 -tuln 沒有 -p 的引數。 Depending on your version of Mac OS X, use one of these: lsof -n
Mac OS X 中 HomeBrew 國內映象
HomeBrew 這貨下載更新不是很穩定,時快時慢,讓我們用映象燥起來 映象&源>走起來 $ cd /usr/local && git remote set
JDK,JRE在mac OS X中的目錄結構
首先要明確一個問題,JDK與JRE的區別是什麼? JRE: Java Runtime Environment. It is basically the Java Virtual Machine where your Java programs run on.
Mac OS X 10.9 配置jdk1.7
--首先,我們下載個eclipse,或者任何java執行程式,雙擊,Mac OS會提示你安裝jre執行時環境,按照提示安裝就可以了,Mac OS 10.9會安裝jdk1.6。 蘋果提供的Java都安裝在/System/Library/Frameworks/JavaVM.fr
Mac OS X 中安裝 brew
不想被誤導?直接看官方文件: 先安裝Git,開啟一個shell cd /usr/localsudo mkdir homebrewcurl -L https://github.com/mxcl/homebrew/tarball/master | sudo tar x
Mac OS X下安裝配置MySQL資料庫
最近需要在電腦上自己搭一個數據庫,由於在大學期間使用的是MySQL,也算是對它情有獨鍾吧,這次在Mac上依舊就使用MySQL吧,在這裡記錄一下安裝以及配置的過程(注:博文中使用的OS X版本為:10.11.4) MySQL下載 要想配置,當然需要安
Mac OS X下顯示/隱藏檔案
在類Unix系統和Linux系統中的“隱藏”檔案都是以點"."為檔名開頭的。在Mac OS中也是如此。此種檔案在預設的Finder和各種應用程式中是不顯示的。這樣做的一個好處是,很多時候那些“隱藏”檔案裡可能包含了某個應用程式的重要配置,重要資料等資訊,如果“不明真相”的
Mac OS X中MacPorts安裝和使用
官方網站http://www.macports.org/install.php下載安裝即可。 MacPorts使用: 更新ports tree和MacPorts版本 sudo port -v selfupdate 搜尋索引中的軟體 port search name 安裝新
Nginx配置檔案-nginx.conf 操作註解
Nginx伺服器nginx.conf的配置檔案說明: #執行使用者 user www-data; #啟動程序,通常設定成和cpu的數量相等 worker_processes 1; #全域性錯誤日誌及PID檔案 error_log /
拆分nginx配置檔案nginx.conf的server,放到自定義位置
修改後nginx.conf(只要改server內容為 include /etc/nginx/conf.d/*.conf;) #user nobody; worker_processes 1;