005-配置文件
2019-06-05 本文已影响0人
mo371
进入nginx的主目录 /etc/nginx/nginx.conf
[root@VM_0_4_centos ~]# cat /etc/nginx/nginx.conf|grep -v "#"|grep -v "^$"
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
sendfile on; //开启高效文件传输模式
keepalive_timeout 65; //超时时间65S
include /etc/nginx/conf.d/*.conf;
}
之后我们查看 /etc/nginx/conf.d/default.conf
进入nginx的主目录 /etc/nginx/conf.d/default.conf
[root@VM_0_4_centos ~]# cat /etc/nginx/conf.d/default.conf|grep -v "#"|grep -v "^$"
server {
listen 80; //监听端口为 80
server_name localhost; //设置主机域名
location / {
root /usr/share/nginx/html; //设置虚拟主机的网站根目录
index index.html index.htm; //设置虚拟主机默认访问的网页
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}