如何配置nginx作為靜態(tài)文件托管服務器
更新時間:2024年01月31日 15:01:24 作者:andy_lau_andy
這篇文章主要介紹了如何配置nginx作為靜態(tài)文件托管服務器的相關資料,下載nginx在windows上是個壓縮包,解壓后,使用命令行輸入nginx進行啟動,感興趣的朋友跟隨小編一起看看吧
下載nginx
windows上是個壓縮包
解壓后, 使用命令行輸入 nginx 進行啟動
nginx -s stop
進行停止nginx -s status
查看狀態(tài)
可以配置一下環(huán)境變量
主要是配置文件, windows的nginx配置文件在 conf文件夾下
在http標簽下 添加如下配置
其他地方不用更改,保持原樣即可,
以下是整個配置文件的參考
#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 example.com; root G:\media; index index.html; location / { try_files $uri $uri/ =404; } } }
到此這篇關于配置nginx作為靜態(tài)文件托管服務器的文章就介紹到這了,更多相關nginx靜態(tài)文件托管服務器內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
Nginx could not build the server_names_hash 錯誤的解決辦法
這篇文章主要介紹了Nginx could not build the server_names_hash 錯誤的解決辦法,需要的朋友可以參考下2014-03-03Kubernetes中Nginx服務啟動失敗排查流程分析(Error:?ImagePullBackOff)
這篇文章主要介紹了Kubernetes中Nginx服務啟動失敗排查流程(Error:?ImagePullBackOff),本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-03-03