Nginx - 配置【nginx.config】

Nginx - 配置【nginx.config】

版本:nginx-1.17.5
完善度:未完、待续!

#定义nginx运行的用户和用户组
#user nginx nginx;
#user  nobody;
#nginx进程数,建议设置为等于CPU总核心数
worker_processes  1;

#全局错误日志定义类型,【debug | info | notice | warn | error | crit】
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#进程文件
#pid        logs/nginx.pid;

#工作模式与连接数上限:worker_connections是单个后台worker process进程的最大并发连接数,
#并发总数是worker_processes和worker_connections的乘积,即max_clients=worker_processes*worker_connections
events {
    worker_connections  1024;
}

#http下的一些配置及其意义
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指令指定nginx是否调用sendfile函数来输出文件,对于普通的应用设为on
	#如果用来进行下载等应用磁盘IO重负载应用,可设置为off,以平衡磁盘与网络I/O处理速度,降低系统的负载。
	#注意:如果图片显示不正常,把这个改成off
    sendfile        on;
	#打开目录列表访问,合适下载服务器,默认关闭
	#autoindex on;
	#防止网络阻塞
    #tcp_nopush     on;
	#防止网络阻塞
	#tcp_nodelay on;

	#长连接超时时间,单位是秒
    keepalive_timeout  120

	#打开gzip压缩输出
    #gzip  on;

	#server虚拟主机一些配置及其意义
	#什么是虚拟主机?
	#虚拟主机是一种特殊的软硬件技术,它可以将网络上的每一台计算机分成多个虚拟主机,
	#每个虚拟主机可以独立对外提供www服务,这样就可以实现一台主机对外提供多个web服务,
	#每个虚拟主机之间都是独立的,互不影响
	
	
	# Vue部署
    server {
	listen 9526;
	server_name localhost;
		
	location / {
		root   release/eam 
		try_files $uri $uri/ @router;
		index  index.html;
	}
	location @router{
		rewrite ^.*$ /index.html last;
	}
 
        error_page   500 502 503 504  /50x.html;
         location = /50x.html {
             root   html;
        }
    }

    
}

发布了59 篇原创文章 · 获赞 18 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/weixin_40575457/article/details/103973502