博客
关于我
ngnix配置文件
阅读量:799 次
发布时间: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/

    你可能感兴趣的文章
    Nginx配置负载均衡到后台网关集群
    查看>>
    Nginx配置限流,技能拉满!
    查看>>
    Nginx配置静态代理/静态资源映射时root与alias的区别,带前缀映射用alias
    查看>>
    Nginx面试三连问:Nginx如何工作?负载均衡策略有哪些?如何限流?
    查看>>
    nginx:/usr/src/fastdfs-nginx-module/src/common.c:21:25:致命错误:fdfs_define.h:没有那个文件或目录 #include
    查看>>
    Nginx:NginxConfig可视化配置工具安装
    查看>>
    Nginx:现代Web服务器的瑞士军刀 | 文章末尾送典藏书籍
    查看>>
    ngModelController
    查看>>
    ngrok | 内网穿透,支持 HTTPS、国内访问、静态域名
    查看>>
    ngrok内网穿透可以实现资源共享吗?快解析更加简洁
    查看>>
    ngrok内网穿透可以实现资源共享吗?快解析更加简洁
    查看>>
    NHibernate动态添加表
    查看>>
    NHibernate学习[1]
    查看>>
    NHibernate异常:No persister for的解决办法
    查看>>
    Nhibernate的第一个实例
    查看>>
    NHibernate示例
    查看>>
    nid修改oracle11gR2数据库名
    查看>>
    NIFI1.21.0/NIFI1.22.0/NIFI1.24.0/NIFI1.26.0_2024-06-11最新版本安装_采用HTTP方式_搭建集群_实际操作---大数据之Nifi工作笔记0050
    查看>>
    NIFI1.21.0_java.net.SocketException:_Too many open files 打开的文件太多_实际操作---大数据之Nifi工作笔记0051
    查看>>
    NIFI1.21.0_Mysql到Mysql增量CDC同步中_日期类型_以及null数据同步处理补充---大数据之Nifi工作笔记0057
    查看>>