nginx發佈靜態網頁

 

http://www.jb51.net/article/71384.htmcss

 

切記不要把項目放在/root下 會出現 nginx open() "" failed (13: Permission denied), client: 的錯誤html

chmod 777 /root/xxxxxx nginx

即便修改了權限也不行,建議放在/home之下,新建本身的webapp目錄。web

修改nginx配置文件:(注意 配置靜態文件的路徑)segmentfault

server {
  server_name static.naice.me; // 你的域名或者 ip
  root /www/static-web/static-web; // 你的克隆到的項目路徑
  index index.html; // 顯示首頁
  location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|js|pdf|txt){
    root /www/static-web/static-web;
  } // 靜態文件訪問
}

https://segmentfault.com/a/1190000010487262app

https://www.cnblogs.com/EasonJim/p/7806879.htmlwebapp

https://www.cnblogs.com/piscesLoveCc/p/5794926.htmlspa

https://blog.csdn.net/ljp1919/article/details/72833982.net

https://www.cnblogs.com/sz-jack/p/5206159.htmlcode

相關文章
相關標籤/搜索