Centoshtml
其余安装方法:node
Ubuntunginx
Nginx 默认配置文件为 nginx.confweb
user nginx; // 默认便可 worker_processes auto; // 默认设置自动选择进程数量,能够自行设置 error_log /var/log/nginx/error.log; // 错误信息存储路径 pid /run/nginx.pid; // 进程信息保存文件 # Load dynamic modules. See /usr/share/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; // 最大链接数 } http { // log信息输出格式,能够自行定义 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; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; include /etc/nginx/site-enabled/*.conf; // ubuntu 默认安装,无需定义,若是没有,能够自行定义,定义的是conf配置文件的路径以及名称,必须定义在 http 块中,Nginx会自动搜索相应的配置文件并加载 }
upstream django { # server unix:/root/HHZS.sock; server 127.0.0.1:8001; # for a web port socket (we'll use this first) // 转发请求至 8001 端口与 uwsgi 进行通讯 } server { listen 80 default_server; // 默认监听请求端口 listen [::]:80 default_server; // 同上 charset utf-8; // 默认编码方式 server_name _; // 默认ip访问,能够设置为域名,经过域名访问 root /usr/share/nginx/html; client_max_body_size 75M; # adjust to taste # Django media location /imgs { alias /root/imgs; # your Django project's media files - amend as required } location /statics { alias /root/hhsc2019/hhsc2019/statics; # your Django project's static files - amend as required uwsgi_read_timeout 120s; uwsgi_send_timeout 120s; proxy_read_timeout 1200; } location / { // 默认访问路径 uwsgi_pass django; include /root/hhsc2019/uwsgi_params; # the uwsgi_params file you installed } }