1.nginx 1.1 Tencent Cloud Releases 80 Ports In the Tencent Cloud console, configure a security group for the instance host and add a security rule for...
Django deployment
Published: 2025-07-23 (a year ago)
LinuxNginxDjango

1.nginx


**1.1 Tencent Cloud releases port 80 **

In the console of Tencent Cloud, configure security groups for instance hosts, and add a security rule for port 80 in the inbound direction. If you have any questions about configuration, please refer to Official Instructions. (It will be opened by default after purchasing the server)

*1.2 Install nginx

I don't have too many requirements for the version of nginx. I use dnf package management to install it here. Here, I installed version 1.4.1 with dnf.

shell Copy
dnf install -y nginx

If required:

shell Copy
sudo yum install nginx

After the installation is complete, you can check the version to verify that it was installed correctly

shell Copy
nginx -v

** 1.3 nginx management **

nginx installed based on dnf has been set up, and nginx -s and systemctl can be used to manage nginx conveniently.
Commonly used for systemctl management:

shell Copy
systemctl enable nginx #Boot nginx automatically
systemctl disable nginx #Boot disable nginx
systemctl status nginx #Check nginx service status
systemctl start nginx #Start nginx services
systemctl stop nginx #Terminate nginx services
systemctl restart nginx #Restart nginx services 

You can also use nginx native commands here:

shell Copy
nginx -V			 #View nginx version and configuration item content
nginx -t 			 #Check whether the configuration file is correct
nginx -c configuration file path #Select a configuration file
nginx 				 #Start nginx
nginx -s reload 	 #Reload configuration file
nginx -s stop		 #Stop nginx

**1.4nginx usage **

shell Copy
systemctl start nginx #or directly use nginx to start nginx services
systemctl status nginx #If you see Active becoming active, the boot is normal
lsof -i:80			#You can see that port 80 has been monitored by nginx

After the above series of checks confirm that nginx starts normally, you can enter the public network address or domain name in the browser and see the nginx welcome page.
The nginx configuration file is found in/etc/nginx/nginx.conf

2.Mysql

Centos8's dnf is quite friendly to lazy people. mysql 8.0 can be solved with one command:

shell Copy
dnf install -y @mysql #@mysql module will install MySQL 8.0 and all its dependencies

2.2 Starting mysql

shell Copy
systemctl enable mysqld   #Configure mysql booting and self-booting
systemctl start mysqld       #Start mysqld
systemctl status mysqld   #Check whether mysql started successfully (active running)

**2.3 Security Settings **

Run the following script to set the root password of mysql and guide you through some necessary security settings.

shell Copy
mysql_secure_installation

First, the script will let you choose whether to configure VALIDATE PASSWORD PLUGIN(password verification plug-in), which is used to check the password strength set by mysql users. Only passwords with a certain strength are allowed to be set. If you want to set it, please enter y or Y to enter, otherwise enter directly. If you choose Configuration, you will then choose the level of password authentication policy you use:

>Low: Password length is at least 8 digits
Medium: The password length must be no less than 8 digits and must be a mixture of numbers, upper and lower case letters, and special letters.
Strong: The password length is no less than 8 digits, must be a mixture of numbers, upper and lower case letters, and special letters, and needs to be matched with a dictionary file.

Normally, we just choose the medium level.

Secondly, the user will be required to enter a new password set for root twice. The password verification policy set in the previous step will take effect, and the strength of the password set by the user will be scored. After setting the password, the user will be prompted whether to continue password protection and select y Enter.

Next, the user will be asked whether to delete the anonymous user and select y Enter.

>By default, MySQL has an anonymous user that allows anyone to log in to MySQL without having to create a user account. This is for testing only, or it is easier to install. But before deploying a production environment, you should remove anonymous users.

Then, the user will be asked whether to disable remote login to mysql as root, and select y Enter.

>Generally, root users in mysql should only be allowed to log in locally, not remotely. This reduces the risk of root user passwords being blasted.

After that, the user will be asked whether to delete the test database and select y Enter.

>By default, MySQL always has a database called 'test' that is accessible to any user. This is for testing at installation time only, but the database should be deleted before deploying a production environment.

Finally, the script asks the user whether to overload privilege tables now so that all current changes take effect immediately. Select y Enter.

When we type in the terminal:

shell Copy
mysql -u root -p 			#Enter Enter password and confirm

You can log in to mysql.

**3. Upload your Django project **

** Send your project to gitee or github here **

######Don't forget to create a folder now and pull your projects in the folder directory, remember!

shell Copy
git clone  

>Here, repository_url is the URL address of the Git repository to be cloned, and destination_folder is the specified destination folder path.

shell Copy
git clone https://github.com/example/repo.git myfolder

In this way, the Git repository repo.git will be cloned into the myfolder folder in the current directory.