nginx Download the official website: http://nginx.org/
nginx configuration in detail: https://www.runoob.com/w3cnote/nginx-setup-intro.html
Under 1.windows simple configuration, after installation open nginx installation directory, locate conf / nginx.conf, use a text editor to open and start / restart nginx
nginx官网:http://nginx.org/
1.下载安装后打开nginx安装目录,找到conf/nginx.conf,使用文本打开
#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_names_hash_bucket_size 64;
proxy_buffer_size 128k; # default: 4k|8k
proxy_buffering on; # default: on
proxy_buffers 64 64k; # default: 8 4k|8k
proxy_busy_buffers_size 256k; # default: 8k|16k
proxy_max_temp_file_size 1024m; # default: 1024m
proxy_temp_file_write_size 256k; # default: 8k|16k
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#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;
}
}
server {
listen 80;
server_name ******.com; #*修改为域名
return 301 http://www.******.com$request_uri; #*修改为域名
}
server {
80 the listen;
. server_name www ****** com; # * to modify the domain.
LOCATION / {
the root path; Example # File Path: C: / Test
try_files $ $ URI URI / /index.html;
}
LOCATION / View / {
the root path; # exemplary file path: C: / Test
the rewrite * /index.html BREAK;.
}
}
}
2.nginx commonly used commands
start nginx start nginx
nginx -s quit elegant stop nginx, will wait for a connection request and then kill the worker process is completed when the connection
nginx -s reload elegant restart, and reload the configuration file nginx.conf
nginx -s Reopen reopens the log file, generally used to cut logs
nginx -v view the version
nginx -t check nginx configuration files
nginx -h to see help
nginx -V detailed version information, including a compilation parameters
nginx -c filename specified configuration file