博客
关于我
ngnix配置文件
阅读量:797 次
发布时间:2023-02-15

本文共 2274 字,大约阅读时间需要 7 分钟。

Nginx???????

1. ??????

1.1 ????

worker_processes auto;error_log /var/log/nginx/error.log;pid /run/nginx.pid;# ??????include /usr/share/doc/nginx/README.dynamic.include;include /usr/share/nginx/modules/*.conf;

1.2 ????

events {    worker_connections 1024;}

1.3 ????

http {    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;    tcp_nopush on;    tcp_nodelay on;    keepalive_timeout 65;    types_hash_max_size 2048;    include /etc/nginx/mime.types;    default_type application/octet-stream;        # ??????    include /etc/nginx/conf.d/*.conf;}

1.4 ??????

server {    listen 80;    server_name www.yblisgglib.online;        # ???????HTTPS    rewrite ^/(.*) https://www.yblisgglib.online/$1 permanent;}server {    listen 443 ssl;    server_name www.yblisgglib.online;        # ??????    access_log /var/log/nginx/example.com_access.log combined;    error_log /var/log/nginx/example.com_error.log error;        # ????    ssl_certificate /etc/nginx/cert/4296312_yblisgglib.online.pem;    ssl_certificate_key /etc/nginx/cert/4296312_yblisgglib.online.key;        # ??????    location /static {        alias /home/login/static;    }        # ????    location / {        include uwsgi_params;        uwsgi_pass 127.0.0.1:8000;        proxy_set_header Host $http_host;        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    }}

2. uwsgi.ini??

[uwsgi]socket=127.0.0.1:8000chdir=/home/loginwsgi-file=/home/login/wsgi.pyhome=/env/venvprocesses=4threads=2master=Truepidfile=uwsgi.piddaemonize=uwsgi.logpython-autoreload=1

3. ????????

3.1 ????

  • ??????????????????403 Forbidden?404 Not Found????????Nginx????????????

3.2 ????

  • ???????

    • ?????????????
      location /static {    alias /home/login/static;}
    • ??/home/login/static???????
  • ?????

    • ????????????Nginx?????????????
  • ?????

    • ?????????Nginx???
      sudo systemctl restart nginx
  • 4. ????

    • ???????

      • ????????????????#????????
    • ?????

      • ???????????
        mkdir -p /var/log/nginxchmod 755 /var/log/nginx
    • ?????

      • ??SSL????????????????????
    • uwsgi???

      • ??uwsgi????????????????127.0.0.1:8000?

    ???????????????????????????????????Nginx????????????

    转载地址:http://pyjfk.baihongyu.com/

    你可能感兴趣的文章
    Netty工作笔记0085---TCP粘包拆包内容梳理
    查看>>
    Netty常用组件一
    查看>>
    Netty常见组件二
    查看>>
    netty底层——nio知识点 ByteBuffer+Channel+Selector
    查看>>
    netty底层源码探究:启动流程;EventLoop中的selector、线程、任务队列;监听处理accept、read事件流程;
    查看>>
    Netty心跳检测
    查看>>
    Netty心跳检测机制
    查看>>
    netty既做服务端又做客户端_网易新闻客户端广告怎么做
    查看>>
    Netty核心模块组件
    查看>>
    Netty框架内的宝藏:ByteBuf
    查看>>
    Netty框架的服务端开发中创建EventLoopGroup对象时线程数量源码解析
    查看>>
    Netty源码—1.服务端启动流程一
    查看>>
    Netty源码—1.服务端启动流程二
    查看>>
    Netty源码—2.Reactor线程模型一
    查看>>
    Netty源码—2.Reactor线程模型二
    查看>>
    Netty源码—3.Reactor线程模型三
    查看>>
    Netty源码—3.Reactor线程模型四
    查看>>
    Netty源码—4.客户端接入流程一
    查看>>
    Netty源码—4.客户端接入流程二
    查看>>
    Netty源码—5.Pipeline和Handler一
    查看>>