Modify the PIP source

PIP configuration files are in ~/.pip/pip.conf

The content of the document is as follows:

[global]

index-url = http://mirrors.tencentyun.com/pypi/simple

trusted-host = mirrors.tencentyun.com

Doubanyuan’s website is:

pypi.doubanio.com/simple/

You only need to

index-url = mirrors.tencentyun.com/pypi/simple

trusted-host = mirrors.tencentyun.com

Replace with:

Index-url =pypi.doubanio.com/simple/

trusted-host = pypi.doubanio.com

Can.

Kill the process

Example:

fuser -k 9090/tcp

Online TypeIDEA project

I am writing a Django project that uses UWSGi + nginx

Because it was a long time ago and I don’t know how to write nginx configuration files. So this time, I’m going to launch this blog site using the all-powerful re-installation method.

Input:

yum remove nginx

Uninstall ngginx

Input:

rm -rf /etc/nginx/

Delete the previous configuration file

Input:

yum install nginx

Install nginx

Input:

cd /etc/nginx/

Go to the nginx configuration folder

Input:

ll

You can see the following files

Input:

systemctl nginx.service start

Start the Nginx service, open the browser, and enter the public IP address of the server. If the following information is displayed, the installation is successful.

Next, install uWSGi

Input:

pip3 install uwsgi

Install uwsgi

After the installation is complete, test whether uWSGi is successfully installed

Create a test.py file. The content of the document is as follows:

def application(env, start_response):

start_response(‘200 OK’,[(‘Content-Type’,’text/htm/’)])

return [b’Hello World’]

Then type:

Uwsgi – HTTP :8000 – wsgi-file test.py

Open a browser and enter host IP address :8000

If “Hello World” is displayed, the operation is successful.

Configure the INI file for uWSGi

Uwsgi has a variety of configuration file formats such as INI, XML, etc

I’m using ini

The content of the document is as follows:

[uwsgi]
socket = 127.0.0.1:9090
master = true
#vhost= true
#no-site=true
workers = 2
reload-mercy = 10
vacuum = true
max-requests = 1000
limit-as = 512
buffer-size = 30000
pidfile = /home/log_mysite/typeidea.pid
daemonize = /home/log_mysite/typeidea.log  # uWSGi log files
chdir = /home/mysite/typeidea  # the root directory of your Django project
wsgi-file = /home/mysite/typeidea/typeidea/wsgi.py #wsgi file pathCopy the code

To configure the nginx server, add the following contents to the nginx.conf file

server {
        listen 80;
        server_name typeidea;
        location / {
            include uwsgi_params;
            uwsgi_pass 127.0.0.1:9090;  The socket address must be the same as that in the USGI file
            client_max_body_size 35m;
            }
        location /static/ {
            alias /home/mysite/typeidea/typeidea/static/;  Static file path
            }
        location /media/ {
            alias /home/mysite/typeidea/typeidea/media/;  The media file path to save the file}}Copy the code