1. 程式人生 > >配置阿里雲CentOS7.2+nginx+uwsgi 部署flask專案

配置阿里雲CentOS7.2+nginx+uwsgi 部署flask專案

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/


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_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;


    server {
        listen       80 default_server;

        listen       [::]:80 default_server;
        server_name  伺服器公網ip;
        root         /usr/share/nginx/html;
        #root        /var/www/html;


        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;


        location / {
                include        uwsgi_params;
                uwsgi_pass     127.0.0.1:8001;
                uwsgi_param UWSGI_PYHOME /var/www/myproject/myenv;
                uwsgi_param UWSGI_CHDIR /var/www/myproject;
                uwsgi_param UWSGI_SCRIPT run:app;

        }


        error_page 404 /404.html;
            location = /40x.html {
        }


        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }


# Settings for a TLS enabled server.
#
#    server {
#        listen       443 ssl http2 default_server;
#        listen       [::]:443 ssl http2 default_server;
#        server_name  _;
#        root         /usr/share/nginx/html;
#
#        ssl_certificate "/etc/pki/nginx/server.crt";
#        ssl_certificate_key "/etc/pki/nginx/private/server.key";
#        ssl_session_cache shared:SSL:1m;
#        ssl_session_timeout  10m;
#        ssl_ciphers HIGH:!aNULL:!MD5;
#        ssl_prefer_server_ciphers on;
#
#        # Load configuration files for the default server block.
#        include /etc/nginx/default.d/*.conf;
#
#        location / {
#        }
#
#        error_page 404 /404.html;
#            location = /40x.html {
#        }
#
#        error_page 500 502 503 504 /50x.html;
#            location = /50x.html {
#        }
#    }


}

相關推薦

配置阿里CentOS7.2+nginx+uwsgi 部署flask專案

# For more information on configuration, see: #   * Official English Documentation: http://nginx.org/en/docs/ #   * Official Russian Documentation: http://

阿里Centos7nginx配置http轉https並轉發多tomcat

環境 系統:阿里雲centos7 nginx版本:1.12.2 tomcat版本:8.5 jdk:8 準備 1.需要一個域名(可以用免費的或者買一個便宜點的) 2.系統及各種其他軟體 不足之處望指出,有更好的處理方式也希望能學習交流,謝謝。 獲取域名和免費的

阿里centos7.2安裝nginx

新增CentOS 7 Nginx yum資源庫 rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-cento

阿里Centos7.2配置VNC遠端連線

[Unit] Description=Remote desktop service (VNC) After=syslog.target network.target [Service] Type=forking USER=root # Clean any existing files in /tmp/.X1

阿里 centos7.2部署 LAMP (CentOS 7.2

簡介 LAMP指Linux+Apache+Mysql/MariaDB+Perl/PHP/Python是一組常用來搭建動態網站或者伺服器的開源軟體,本身都是各自獨立的程式,但是因為常被放在一起使用,擁有了越來越高的相容度,共同組成了一個強大的Web應用程式平臺。

阿里 centos7.2部署 LAMP (CentOS 7.2) (轉載,僅供參照)

簡介LAMP指Linux+Apache+Mysql/MariaDB+Perl/PHP/Python是一組常用來搭建動態網站或者伺服器的開源軟體,本身都是各自獨立的程式,但是因為常被放在一起使用,擁有了越來越高的相容度,共同組成了一個強大的Web應用程式平臺。部署方式在阿里雲伺

阿里centos7伺服器nginx配置及常見問題解答

前言: 本文參考了jackyzm的部落格:https://www.cnblogs.com/jackyzm/p/9600738.html,進行了內容的更新,並請注意這裡適用的版本是centos7的版本。並且本文的配置方式曾經在版本8上失敗過,因此檢視本文前最好先確定伺服器的版本。 而關於nginx部分問題的處理

阿里 Centos7.2 搭建redis 叢集

一、環境 1.Centos7.2 三臺 2.Redis叢集要求至少要有三個節點,我這裡配置三臺,每臺一主一備。 3.埠號 6379-6384  需要在阿里雲 安全策略中開通埠,同時要開通16379-16384(叢集匯流排埠為redis客戶端連線的埠 + 10000) 二

阿里centos7安裝NGINX+MYSQL+PHP-FPM環境

阿里雲的雲伺服器(ECS)可以選擇多種作業系統,打算用它執行 Drupal 或者 WordPress ,你最好選擇 Linux 系統,這篇文章的演示是基於阿里雲的 CentOS 作業系統的伺服器。我們在上面搭建一個 nginx + mysql + php-fpm 的環境,這就是常說的 LEMP(Lin

阿里centos7.2安裝mysql-5.7.20

環境:阿里雲centos7.2 mysql版本:mysql-5.7.20 mysql下載地址:https://dev.mysql.com/downloads/mysql/ 選擇對應的版本 安裝步驟 1、下載mysql 命令:wget https://cdn.mysql.c

阿里Centos7.2安裝docker

yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/cento

阿里centos7.2 Mysql開啟遠端訪問

1.在阿里雲本例項的安全組,開啟3306埠(外網) 2.可以使用tennet ip port 來測試埠是否開啟 3.授權root賬號遠端訪問mysql資料庫 mysql> grant all privileges on *.* to 'root'@'%' iden

阿里centos7.2自己安裝mysql5.7遠端不能訪問解決方案

最近,無意中看到阿里雲伺服器降價,所以一時手癢,買了一年的伺服器ECS,只要199,。拿到手很開心,彷彿下一刻自己就要在上傳自己的服務,丟自己的程式碼上去了。所以首先得做一些準備工作,先安裝jdk1.

Nginx+Uwsgi部署Django專案

一、uwsgi介紹 uWSGI是一個Web伺服器,它實現了WSGI協議、uwsgi、http等協議。Nginx中HttpUwsgiModule的作用是與uWSGI伺服器進行交換。 1、 WSGI / uwsgi / uWSGI WSGI是一種Web伺服器閘道器介面。它是一個Web伺服

使用Nginx+uWSGI部署Django專案

1.linux安裝python3環境 參考連結:https://www.cnblogs.com/zzqit/p/10087680.html 2.安裝uwsgi pip3 install uwsgi ln -s /usr/local/python3/bin/uwsgi /usr/local/bin

Centos7中使用uwsgi部署Django專案

uwsgi uWSGI實現了WSGI的所有介面,是一個快速、自我修復、開發人員和系統管理員友好的伺服器。uWSGI程式碼完全用C編寫,效率高、效能穩定。 1、安裝uwsgi pip install uwsgi 2、配置uWSGI,在專案目錄下建立uwsgi.ini檔案,配置如下:

從零開始搭建個人網站(6)nginx+uWSGI部署Django專案(上)

  Django雖然自帶一個Server,但只能作為開發時測試使用,我們需要一個可以穩定而持續的伺服器對網站進行部署,比如Apache, Nginx, lighttpd等,本篇將利用nginx和uWSGI部署Django網站專案。 前言 n

使用nginx+uWSGI部署flask應用

nginx配置檔案一般放在 /etc/nginx/sites-enabled 或者 /etc/nginx/conf.d 這兩個資料夾下面,後序名為 .conf,最簡單的配置如下: server {     listen 5000;     server_name local

Django學習筆記五:通過nginx+uwsgi部署Django專案(暫時靜態檔案沒有部署上去)

概念 Nginx:是一款面向效能設計的HTTP伺服器,相較於Apache、lighttpd具有佔有記憶體少,穩定性高等優勢 uwsgi::是一個Web伺服器,它實現了WSGI協議、uwsgi、http等協議。Nginx中HttpUwsgiModule的作用是

gunicorn +nginx+python3 部署flask專案(gevent+gevent)--依賴的包

gunicorn +nginx+python3 部署(gevent+gevent)--依賴的包 bind = [&quo