如何配置nginx作為靜態(tài)文件托管服務(wù)器
下載nginx
windows上是個壓縮包
解壓后, 使用命令行輸入 nginx 進(jìn)行啟動
nginx -s stop 進(jìn)行停止nginx -s status 查看狀態(tài)
可以配置一下環(huán)境變量
主要是配置文件, windows的nginx配置文件在 conf文件夾下
在http標(biāo)簽下 添加如下配置

其他地方不用更改,保持原樣即可,
以下是整個配置文件的參考
#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;
}
}
}到此這篇關(guān)于配置nginx作為靜態(tài)文件托管服務(wù)器的文章就介紹到這了,更多相關(guān)nginx靜態(tài)文件托管服務(wù)器內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Nginx could not build the server_names_hash 錯誤的解決辦法
這篇文章主要介紹了Nginx could not build the server_names_hash 錯誤的解決辦法,需要的朋友可以參考下2014-03-03
Kubernetes中Nginx服務(wù)啟動失敗排查流程分析(Error:?ImagePullBackOff)
這篇文章主要介紹了Kubernetes中Nginx服務(wù)啟動失敗排查流程(Error:?ImagePullBackOff),本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-03-03
nginx服務(wù)器實現(xiàn)上傳下載文件的實例代碼
這篇文章主要介紹了nginx服務(wù)器實現(xiàn)上傳下載文件的實例代碼,本文通過代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作有一定的幫助,需要的朋友可以參考下2024-02-02

