nginx 配置

1 server {                                                                                                                                                                                                                                                                  
  2     listen 端口号;
  3     server_name 你的url;
  4     ssl on;
  5     ssl_certificate 你的url认证;
  6     ssl_certificate_key 你的url认证key;
  7 
  8     # 静态文件服务
  9     location /download/static/ {
 10         rewrite  ^/download/static/(.*)$ /$1 break;
 11         root /data/static;
 12     }
 13 
 14     # 后端地址
 15     location /api/ {
 16         rewrite  ^/api/(.*)$ /$1 break;
 18         proxy_pass http://127.0.0.1:12001/;
 19         include /etc/nginx/uwsgi_params;    # 包含uwsgi_params 的路径
 20 
 21         uwsgi_read_timeout 300;
 22         uwsgi_send_timeout 300;
 23         proxy_read_timeout 300;
 24         proxy_ignore_client_abort on;
 25 
 26         proxy_buffer_size 40960k;
 27         proxy_buffers 4 40960k;
 28         client_max_body_size 20m;
 29     }
 30 
 31     # 前端地址
 32     location / {
 33         root vue的地址;
 34         index index.html index.htm;
 35     }
 36 }

vue和python的nginx配置的server配置

nginx的base配置

  1 user root;                                                                                                                                                                                                                                                                
  2 worker_processes auto;
  3 pid /run/nginx.pid;
  4 
  5 events {    # 时间设置,控制Nginx处理连接方式
  6     worker_connections 768;
  7     # multi_accept on;
  8 }
  9 
 10 http {
 11 
 12     ##
 13     # Basic Settings
 14     ##
 15 
 16     sendfile on;
 17     tcp_nopush on;
 18     tcp_nodelay on;
 19     keepalive_timeout 65;
 20     types_hash_max_size 2048;
 21     # server_tokens off;
 22 
 23     # server_names_hash_bucket_size 64;
 24     # server_name_in_redirect off;
 25 
 26     include /etc/nginx/mime.types;
 27     default_type application/octet-stream;
 28 
 29     ##
 30     # SSL Settings
 31     ##
 32 
 33     ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
 34     ssl_prefer_server_ciphers on;
 35 
 36     ##
 37     # Logging Settings
 38     ##
 39 
 40     access_log /var/log/nginx/access.log;
 41     error_log /var/log/nginx/error.log;
 42 
 43     ##
 44     # Gzip Settings
 45     ##
 46 
 47     gzip on;
 48     gzip_disable "msie6";
 49 
 50     # gzip_vary on;
 51     # gzip_proxied any;
 52     # gzip_comp_level 6;
 53     # gzip_buffers 16 8k;
 54     # gzip_http_version 1.1;
 55     # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
 57     ##
 58     # Virtual Host Configs
 59     ##
 60     
 61     include /etc/nginx/sites-enabled/*;    # 你设置的nginx配置的有效路径
 62     include /etc/nginx/conf.d/*.conf;
 63     
 64 } 

#mail {
68 # # See sample authentication script at:
69 # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
70 #
71 # # auth_http localhost/auth.php;
72 # # pop3_capabilities "TOP" "USER";
73 # # imap_capabilities "IMAP4rev1" "UIDPLUS";
74 #
75 # server {
76 # listen localhost:110;
77 # protocol pop3;
78 # proxy on;
79 # }
80 #
81 # server {
82 # listen localhost:143;
83 # protocol imap;
84 # proxy on;
85 # }
86 #}



原文地址:https://www.cnblogs.com/1a2a/p/10227204.html