windows10下面部署nginx(解决文件名中文乱码问题)
2016-01-06 13:43
771 查看
由于开发需要,我们总是需要先在windows环境下面部署项目进行测试,通过之后才会移植到linux系统进行测试部署。
本篇文章会介绍一下windows终端下面部署nginx WEB服务的一些步骤流程,仅供参考!
一、nginx for windows源码包下载:
http://nginx.org/download/nginx-1.9.9.zip #作者在部署的时候最新的版本是1.9.9
二、安装
由于nginx采用的是一种开包即用的模式,所以直接解压缩nginx-1.9.9.zip,然后将获得的nginx-1.9.9文件目录直接放到自己的安装路径。本人存放的路径为:D:\Program Files\nginx-1.9.9
然后设置系统的环境变量:
1.新建nginx的变量名及指向路径
nginx.conf
备注:因为windows使用的gbk格式的文件编码,而Linux系统中支持中文的编码则是utf-8.所以为了在windows下面支持文件名中文的正常显示,在http或server段添加下面的代码参数:
四、nginx使用命令(CMD控制台下命令)
1.nginx启动:
2.nginx重启:
3.nginx关闭
4.日志文件切割
参考官方文档:http://nginx.org/en/docs/windows.html
本篇文章会介绍一下windows终端下面部署nginx WEB服务的一些步骤流程,仅供参考!
一、nginx for windows源码包下载:
http://nginx.org/download/nginx-1.9.9.zip #作者在部署的时候最新的版本是1.9.9
二、安装
由于nginx采用的是一种开包即用的模式,所以直接解压缩nginx-1.9.9.zip,然后将获得的nginx-1.9.9文件目录直接放到自己的安装路径。本人存放的路径为:D:\Program Files\nginx-1.9.9
然后设置系统的环境变量:
1.新建nginx的变量名及指向路径
#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; autoindex on; autoindex_exact_size off; autoindex_localtime off; # 显示本机时间而非 GMT 时间 gzip on; gzip_comp_level 7; gzip_min_length 1024; gzip_buffers 4 8k; gzip_types text/plain application/javascript text/css ; output_buffers 1 32k; postpone_output 1460; server { listen 8080; server_name localhost; #charset koi8-r; charset gbk,utf8; #access_log logs/host.access.log main; location /soft/ { root E:\soft; index index.html index.htm; } location /ckfinder/ { root D:\webproject\ckfinder; index ckfinder.html; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location /phpmyadmin/ { root D:\webproject\phpMyAdmin; fastcgi_pass 127.0.0.1:9001; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
nginx.conf
备注:因为windows使用的gbk格式的文件编码,而Linux系统中支持中文的编码则是utf-8.所以为了在windows下面支持文件名中文的正常显示,在http或server段添加下面的代码参数:
charset gbk,utf8; #注意先后顺序
四、nginx使用命令(CMD控制台下命令)
1.nginx启动:
start nginx
2.nginx重启:
nginx -s reload
3.nginx关闭
nginx -s stop #快速关闭
nginx -s quit #正常关闭
4.日志文件切割
nginx -s reopen #重启日志文件,即对日志文件进行切割
参考官方文档:http://nginx.org/en/docs/windows.html
相关文章推荐
- nginx的编译安装以及启动脚本编写
- 配置解决Nginx服务器中WordPress路径不自动加斜杠问题
- Nginx服务器中配置404错误页面时一些值得注意的地方
- Nginx中配置过滤爬虫的User-Agent的简单方法
- Nginx服务器初期基本配置指南
- Nginx启动脚本和配置文件
- Nginx中防止SQL注入攻击的相关配置介绍
- nginx启动、重启、关闭
- nginx websocket
- Nginx 替换WEBRICK
- Linux 安装并部署python+django+uwsgi+nginx总结
- centos7 安装 nginx1.9.2
- Windows下nginx配置python服务器
- nginx常用命令
- mac下nginx的安装-安装记录
- Nginx的安装与配置(一)
- (转)Nginx + uwsgi + web.py + MySQLdb
- Nginx日志文件配置与切割
- Nginx配置文件nginx.conf中文详解
- nginx提示Error: Too many open files的解决办法