Nginx 简介

发布于:2024-04-01 ⋅ 阅读:(56) ⋅ 点赞:(0)

文章目录


一.Nginx简介   

        Nginx具有轻量级、高性能和低内存占用等特点,可以在多核处理器上有效地分配负载。它可以作为静态内容服务器,也可以作为反向代理服务器,将请求转发给其他服务器。Nginx还可以处理动态内容,如使用FastCGI、SCGI或uWSGI协议与其他应用程序进行通信。

Nginx的配置文件简单易懂,可以通过修改配置文件来实现各种功能和性能优化。它还提供了许多可扩展的模块,可以在需要时进行加载。

 Nginx软件的主要企业应用功能

  • 作为Web服务软件
  • 反向代理或负载均衡
  • 前端业务数据缓存服务

Nginx-源码安装步骤

 Nginx配置文件解析

#Nginx默认访问路径
[root@localhost sbin]# cd /usr/local/nginx/html
[root@localhost html]# ls
50x.html  index.html
#Nginx配置文件路径
[root@localhost ~]# cat /usr/local/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 {                                   
        listen       80;                       #监听端口
        server_name  localhost;                #域名

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {                           #
            root   html;
            index  index.html index.htm;
        }


总结

本文含有隐藏内容,请 开通VIP 后查看

网站公告

今日签到

点亮在社区的每一天
去签到