首先進入nginx的配置文件nginx.conf;php
1 #至關於在http模塊再添加一個server模塊 2 server { 3 #監聽綁定80端口 4 listen 80; 5 #下面這個是域名,多個域名用空格隔開 6 server_name www.a.com bb.com; 7 #本網站的根路徑 8 root /絕對路徑; 9 #下面是默認首頁 10 location / { 11 index index.html index.php; 12 } 13 #下面是針對本站全部.php文件進行處理的配置 14 location ~ \.php{ 15 #加載fastcgi 一種處理方式 16 include fastcgi_params; 17 #fastcgi的參數 指定文件路徑及參數,不然會有404或是file not find 提示 18 fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; 19 #fastcgi的服務信息 ip:端口 20 fastcgi_pass 127.0.0.1:9000; 21 #fastcgi默認首頁 22 fastcgi_index index.php; 23 } 24 }