1.進入nginx的官網,下載nginx。地址為:http://nginx.org/en/download.html。
2.解壓后路徑如下圖所示。
3.打開conf/nginx.conf文件進行編輯。
4.將root的值改為項目路徑。
5.點擊nginx.exe啟動nginx。
注意,不要多次啟動nginx,啟動nginx過多則需要到任務管理器一一關閉。
6.進入頁面,如http://localhost/pages/frameworkView/register.html。其中localhost表示配置的項目路徑。
另外,我們也可以將不同應用部署在不同端口下,即在server平級的目錄下新增一個server配置,即可根據所配置的端口號訪問應用。
配置示例如下:
server { listen 8888; server_name localhost; location / { root C:/Users/luoyihao/Desktop/blockchain-new; index index.html index.htm; } }