The latest version of nginx liunx installs flask deployment

1. nginx installation

1. Enter the resource download page of Nginx official website: http://nginx.org/en/download.html

2. Download nginx-1.22.1.tar.gz,

3 Unzip:

tar -zxvf nginx-1.22.1.tar.gz

 After the decompression is complete, a new nginx folder will be obtained in the current directory

4. The terminal enters the nginx folder directory, executes the configuration command, and waits for the configuration to complete 

./configure --prefix=/usr/local/nginx-1.22.1 --with-http_ssl_module --with-http_stub_status_module

5. Continue to execute instructions on the terminal, compile and install Nightx in the directory /usr/local/nginx-1.22.1 configured in the previous step

make & make install 

Wait for the installation to complete.

6. Enter the sbin directory under the installation directory /usr/local/nginx-1.22.1 and execute the command 

./nginx

7. Enter the IP address of the server in the address bar of the browser, and you can enter the following page to indicate that the server nginx is installed successfully!

nginx installation complete

 

Two, python3 flask related installation and deployment

1.python3

2.pip install uwsgi and flask

pip3 install uwsgi flask

2. Create a flask project:

 

3. Write a configuration file (uwsgi_conf.ini)

[uwsgi]
#监听端口
socket = 127.0.0.1:5000
#进程
processes = 1
#线程
threads = 1
master = true
#项目路径
pythonpath = /home/DeveloperHeadlines
#项目名称 (module为文件名)
module = manager.py
#回调
callable = app
#开启内存使用情况报告
memory-report = true
#自动更新
py-autoreload = 1

4. run flask

uwsgi --ini uwsgi_conf.ini -d ./log/uwsgi.log

 Three nginx configuration flask related parameters

1. Edit the nginx configuration file (vim /usr/local/nginx-1.22.1/conf/nginx.conf)

Add a server service

 

 2. Online deployment test

 

Guess you like

Origin blog.csdn.net/wywinstonwy/article/details/130676872