Nginx
Mac
$ brew install nginx
$ nginx //localhost:8080 可以看到表示正常啟動
$ nginx -v //版本
$ nginx -s stop
$ nginx -s reload
usr > local > var > www 下
設定檔案在 /usr/local/etc/nginx/nginx.conf 也可以在servers目錄裡面加入.conf檔
將leonsnoopyleo.com路徑透過proxy導入到 localhost:8877
leonsnoopyleo.com/leo/cgi-bin 導入到 localhost:8888/leo/cgi-bin
server {
listen 80;
server_name leonsnoopyleo.com;
location / {
proxy_pass http://localhost:8877;
}
location /leo/cgi-bin {
proxy_pass http://localhost:8888/leo/cgi-bin;
}
}
將localhost:8877 指向絕對路徑的資料夾開啟index.html
server {
listen 8877;
server_name localhost;
location / {
root /Users/leo/Desktop/work/ifttt/dist/;
index index.html index.htm;
}
}
原本的
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
修改後
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 leonsnoopyleo.com
這樣dns就會優先判斷這個leonsnoopyleo.com網域指向到本機
將nginx.conf 這個註解拿掉
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;
}