博客
关于我
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/

    你可能感兴趣的文章
    nacos config
    查看>>
    Nacos在双击startup.cmd启动时提示:Unable to start embedded Tomcat
    查看>>
    Nacos安装教程(非常详细)从零基础入门到精通,看完这一篇就够了
    查看>>
    Nacos配置中心集群原理及源码分析
    查看>>
    nacos配置自动刷新源码解析
    查看>>
    Nacos集群搭建
    查看>>
    nacos集群搭建
    查看>>
    nagios安装文档
    查看>>
    Navicat for MySQL 查看BLOB字段内容
    查看>>
    Neo4j电影关系图Cypher
    查看>>
    Neo4j的安装与使用
    查看>>
    Neo4j(2):环境搭建
    查看>>
    Neo私链
    查看>>
    nessus快速安装使用指南(非常详细)零基础入门到精通,收藏这一篇就够了
    查看>>
    Nessus漏洞扫描教程之配置Nessus
    查看>>
    Nest.js 6.0.0 正式版发布,基于 TypeScript 的 Node.js 框架
    查看>>
    nestJS学习
    查看>>
    Net 应用程序如何在32位操作系统下申请超过2G的内存
    查看>>
    NetApp凭借领先的混合云数据与服务把握数字化转型机遇
    查看>>
    NetBeans IDE8.0需要JDK1.7及以上版本
    查看>>