Home Backend Development PHP Tutorial Five steps to teach you how to deploy Django programs using Nginx+uWSGI+Django method

Five steps to teach you how to deploy Django programs using Nginx+uWSGI+Django method

Jul 29, 2016 am 09:15 AM
django nginx uwsgi

Django can be deployed in many ways, and nginx+uwsgi is one of the more common ways. In this method, our usual approach is to use nginx as the front end of the server, which will receive all requests from the WEB and manage the requests uniformly. nginx handles all static requests by itself (this is the strength of NGINX). Then, NGINX passes all non-static requests to Django through uwsgi, which is processed by Django to complete a WEB request. It can be seen that uwsgi functions like a bridge. Act as a bridge.

NOTE: WEB services can also be implemented using only uwsgi+django without using nginx. uwsgi can also handle WEB requests directly.

In order to complete the deployment of the above method, I will divide it into two articles to explain respectively.
  • The first step is to solve the bridge between uwsgi and django. Solve the problem of how to use uwsgi+DJANGO to implement a simple Web server without nginx.

  • The second step is to solve the bridge between uwsgi and Nginx. Through the bridge between nginx and uwsgi, the connection between nginx and django is opened, so as to realize the deployment of django more perfectly.

  • This article will be divided into five steps to explain in detail the deployment method of uwsgi+django. The deployment of nginx+uwsgi+django will be explained in the next article. Outline of this article:
  • Environment introduction
  • Install uwsgi
  • Test uwsgi
  • Configure django
  • Connect django and uwsgi to implement a simple Web server.
  • Environment introduction

  • Ubuntu 12.04.1 LTS
  • django 1.4.2
  • Install uwsgi

    1. Install pipYou can refer to this article: http://www.jsxubar.info/install- pip.html2. Install uwsgi
    <spanpalatino linotype new roman color:rgb>$ <spanpalatino linotype new roman color:rgb>export <spanpalatino linotype new roman color:rgb>LDFLAGS<spanpalatino linotype new roman color:rgb>=<spanpalatino linotype new roman color:rgb>"-Xlinker --no-as-needed"<spanpalatino linotype new roman color:rgb>$ pip install uwsgi
    </spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino>
    Copy after login

    Test uwsgi

    Write a test.py
    # test.py
    def application(env, start_response):
        start_response('200 OK', [('Content-Type','text/html')])
        return "Hello World"
    
    Copy after login
    on your machine and then execute the shell command:
    uwsgi --http :8001 --wsgi-file test.py
    
    Copy after login
    Visit the webpage: http://127.0 .0.1:8001/Check if there is Hello World on the webpage

    Configure django

    NOTE:

    Please ensure that your django project is in normal use. You can use

    python manage.py runserver 0.0.0.0:8002

    to test whether your django project can run normally.

    Please make sure your django program is closed. Write the django_wsgi.py file and place it in the same directory as the manage.py file.

    Note: When writing files, you need to pay attention to the statement os.environ.setdefault. For example, if your project is mysite, your statement should be os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    Copy after login

    <spanpalatino linotype new roman color:rgb font-style:italic>#!/usr/bin/env python<spanpalatino linotype new roman color:rgb font-style:italic># coding: utf-8<spanpalatino linotype new roman color:rgb font-weight:bold>import<spanpalatino linotype new roman color:rgb font-weight:bold>os<spanpalatino linotype new roman color:rgb font-weight:bold>import<spanpalatino linotype new roman color:rgb font-weight:bold>sys<spanpalatino linotype new roman color:rgb font-style:italic># 将系统的编码设置为UTF8<spanpalatino linotype new roman color:rgb>reload<spanpalatino linotype new roman>(<spanpalatino linotype new roman>sys<spanpalatino linotype new roman>)<spanpalatino linotype new roman>sys<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman>setdefaultencoding<spanpalatino linotype new roman>(<spanpalatino linotype new roman color:rgb>'utf8'<spanpalatino linotype new roman>)<spanpalatino linotype new roman>os<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman>environ<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman>setdefault<spanpalatino linotype new roman>(<spanpalatino linotype new roman color:rgb>"DJANGO_SETTINGS_MODULE"<spanpalatino linotype new roman>,<spanpalatino linotype new roman color:rgb>"mysite.settings"<spanpalatino linotype new roman>)<spanpalatino linotype new roman color:rgb font-weight:bold>from<spanpalatino linotype new roman color:rgb font-weight:bold>django.core.handlers.wsgi<spanpalatino linotype new roman color:rgb font-weight:bold>import<spanpalatino linotype new roman>WSGIHandler<spanpalatino linotype new roman>application<spanpalatino linotype new roman color:rgb>=<spanpalatino linotype new roman>WSGIHandler<spanpalatino linotype new roman>()</spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino>
    Copy after login

    连接django和uwsgi,实现简单的Web服务器

    我们假设你的Django项目的地址是/home/work/src/sites/testdjango1/testdjango/mysite,然后,就可以执行以下命令:
    uwsgi --http :8000 --chdir /home/work/src/sites/testdjango1/testdjango/mysite --module django_wsgi
    
    Copy after login
    这样,你就可以在浏览器中访问你的Django程序了。所有的请求都是经过uwsgi传递给Django程序的。

    最后:

    关于如何将uwsgi与Nginx连接,可以期待下篇文章 《五步教你实现使用Nginx+Uwsgi+Django方法部署Django程序(下)》最后面,请大家要支持Django中国社区哦,单靠一两个人是不行的,一起推广一下,让Django社区更有力量哈!更有人气哈!推广链接: http://django-china.cn/

    参考、解释及其它

  • wsgi: WSGI是一种Web服务器网关接口。它是一个Web服务器(如nginx)与应用服务器(如uWSGI服务器)通信的一种规范。

    关于WSGI协议看这里:WSGI

  • uWSGI: http://uwsgi-docs.readthedocs.org/en/latest/index.html uWSGI是一个Web服务器,它实现了WSGI协议、uwsgi、http等协议。 Nginx中HttpUwsgiModule的作用是与uWSGI服务器进行交换。

  • uwsgi: uwsgi同WSGI一样是一种通信协议,而uWSGI是实现了uwsgi和WSGI两种协议的Web服务器

    uwsgi协议是一个uWSGI服务器自有的协议,它用于定义传输信息的类型(type of information),每一个uwsgi packet前4byte为传输信息类型描述,它与WSGI相比是两样东西。

    关于uwsgi协议看这里:The uwsgi protocol

  • 有了uWSGI为什么还需要nginx?

    nginx具备优秀的静态内容处理能力,然后将动态内容转发给uWSGI服务器,这样可以达到很好的客户端响应。

  • 参考文献:http://heipark.iteye.com/blog/1750970

  • 当然,单单只有uWSGI是不够的,在实际的部署环境中,Nginx是必不可少的工具。

    在本篇文章中,我将一直延用“N步法”的风格来阐述如何将uWSGI与Nginx做连接来部署Django程序。并在最后,会较为完整的阐述本社区的部署方法。本文大纲:
  • 环境介绍
  • 配置uWSGI
  • 配置Nginx
  • Nginx+uWSGI+Django的实现方式
  • 一些建议
  • 环境介绍

  • Ubuntu 12.04.1 LTS
  • django 1.4.2
  • nginx/1.2.6
  • uWSGI 1.4.4
  • 关于uWSGI的安装可参见上一篇文章 上一篇文章《五步教你实现使用Nginx+uWSGI+Django方法部署Django程序(上)》我们假定你已经安装好Nginx了。

    配置uWSGI

    在上一篇文章《五步教你实现使用Nginx+uWSGI+Django方法部署Django程序(上)》中,我们是直接使用命令行来启动uWSGI,在实际部署环境中,我们常用的是配置文件的方式,而非命令行的方式。我的一般做法是用命令行来测试是否uWSGI安装成功,然后用配置文件来真正部署。另外,为了实现Nginx与uWSGI的连接,两者之间将采用soket来通讯方式。在本节中,我们将使用uWSGI配置文件的方式来改进uWSGI的启动方式。假定你的程序目录是 /home/work/src/sites/testdjango1/testdjango/mysite我们将要让Nginx采用8077端口与uWSGI通讯,请确保此端口没有被其它程序采用。注意,请确定你在上一节《五步教你实现使用Nginx+uWSGI+Django方法部署Django程序(上)》中的django_wsgi.py文件已经存在了。新建一个XML文件:djangochina_socket.xml,将它放在 /home/work/src/sites/testdjango1/testdjango/mysite 目录下:
    <spanpalatino linotype new roman color:rgb font-weight:bold><uwsgi><spanpalatino linotype new roman color:rgb font-weight:bold><socket>:8077<spanpalatino linotype new roman color:rgb font-weight:bold></socket><spanpalatino linotype new roman color:rgb font-weight:bold><chdir>/home/work/src/sites/testdjango1/testdjango/mysite<spanpalatino linotype new roman color:rgb font-weight:bold></chdir><spanpalatino linotype new roman color:rgb font-weight:bold><module>django_wsgi<spanpalatino linotype new roman color:rgb font-weight:bold></module><spanpalatino linotype new roman color:rgb font-weight:bold><processes>4<spanpalatino linotype new roman color:rgb font-weight:bold></processes><spanpalatino linotype new roman color:rgb font-style:italic><!-- 进程数 --><spanpalatino linotype new roman color:rgb font-weight:bold><daemonize>uwsgi.log<spanpalatino linotype new roman color:rgb font-weight:bold></daemonize><spanpalatino linotype new roman color:rgb font-weight:bold></uwsgi></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino>
    Copy after login
    在上面的配置中,我们使用 uwsgi.log 来记录日志,开启4个进程来处理请求。这样,我们就配置好uWSGI了。

    配置Nginx

    我们假设你将会把Nginx程序日志放到你的目录/home/work/var/test/logs/下,请确保该目录存在。我们假设你的Django的static目录是/home/work/src/sites/testdjango1/testdjango/collectedstatic/ , media目录是/home/work/src/sites/testdjango1/testdjango/public/media/,请确保这些目录存在。我们假设你的域名是 www.you.com (在调试时你可以设置成你的机器IP)我们假设你的域名端口是 80(在调试时你可以设置一些特殊端口如 8070)基于上面的假设,我们为conf/nginx.conf添加以下配置
    <spanpalatino linotype new roman color:rgb font-weight:bold>server<spanpalatino linotype new roman>{<spanpalatino linotype new roman>listen<spanpalatino linotype new roman color:rgb>80<spanpalatino linotype new roman>;<spanpalatino linotype new roman>server_name<spanpalatino linotype new roman>www<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman>you<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman>com<spanpalatino linotype new roman>;<spanpalatino linotype new roman>access_log<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>home<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>work<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>var<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>test<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>logs<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>access<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman>log<spanpalatino linotype new roman>;<spanpalatino linotype new roman>error_log<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>home<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>work<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>var<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>test<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>logs<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>error<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman>log<spanpalatino linotype new roman>;<spanpalatino linotype new roman color:rgb>#charse<spanpalatino linotype new roman>t<spanpalatino linotype new roman>koi8<spanpalatino linotype new roman color:rgb>-<spanpalatino linotype new roman>r<spanpalatino linotype new roman>;<spanpalatino linotype new roman color:rgb>#access<spanpalatino linotype new roman>_log<spanpalatino linotype new roman>logs<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>host<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman>access<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman>log<spanpalatino linotype new roman>main<spanpalatino linotype new roman>;<spanpalatino linotype new roman>location<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>{<spanpalatino linotype new roman><strong>include</strong><spanpalatino linotype new roman>uwsgi_params<spanpalatino linotype new roman>;<spanpalatino linotype new roman>uwsgi_pass<spanpalatino linotype new roman color:rgb>127<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman color:rgb>0<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman color:rgb>0<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman color:rgb>1<spanpalatino linotype new roman color:rgb>:<spanpalatino linotype new roman color:rgb>8077<spanpalatino linotype new roman>;<spanpalatino linotype new roman>}<spanpalatino linotype new roman color:rgb>#error_page<spanpalatino linotype new roman color:rgb font-weight:bold>404<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman color:rgb font-weight:bold>404<spanpalatino linotype new roman color:rgb font-weight:bold>.html<spanpalatino linotype new roman color:rgb>;<spanpalatino linotype new roman>#<spanpalatino linotype new roman color:rgb font-weight:bold>redirect<spanpalatino linotype new roman color:rgb font-weight:bold>server<spanpalatino linotype new roman color:rgb font-weight:bold>error<spanpalatino linotype new roman color:rgb font-weight:bold>pages<spanpalatino linotype new roman color:rgb font-weight:bold>to<spanpalatino linotype new roman color:rgb font-weight:bold>the<spanpalatino linotype new roman color:rgb font-weight:bold>static<spanpalatino linotype new roman color:rgb font-weight:bold>page<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman color:rgb font-weight:bold>50x<spanpalatino linotype new roman color:rgb font-weight:bold>.html<spanpalatino linotype new roman>#<spanpalatino linotype new roman color:rgb font-weight:bold>error_page<spanpalatino linotype new roman color:rgb font-weight:bold>500<spanpalatino linotype new roman color:rgb font-weight:bold>502<spanpalatino linotype new roman color:rgb font-weight:bold>503<spanpalatino linotype new roman color:rgb font-weight:bold>504<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman color:rgb font-weight:bold>50x<spanpalatino linotype new roman color:rgb font-weight:bold>.html<spanpalatino linotype new roman color:rgb>;<spanpalatino linotype new roman color:rgb font-weight:bold>location<spanpalatino linotype new roman color:rgb>=<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman color:rgb font-weight:bold>50x<spanpalatino linotype new roman color:rgb font-weight:bold>.html<spanpalatino linotype new roman>{<spanpalatino linotype new roman>root<spanpalatino linotype new roman>html<spanpalatino linotype new roman>;<spanpalatino linotype new roman>}<spanpalatino linotype new roman color:rgb font-weight:bold>location<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman color:rgb font-weight:bold>static<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>{<spanpalatino linotype new roman>alias<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>home<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>work<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>src<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>sites<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>testdjango1<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>testdjango<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>collectedstatic<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>;<spanpalatino linotype new roman>index<spanpalatino linotype new roman>index<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman>html<spanpalatino linotype new roman>index<spanpalatino linotype new roman color:rgb>.<spanpalatino linotype new roman>htm<spanpalatino linotype new roman>;<spanpalatino linotype new roman>}<spanpalatino linotype new roman color:rgb font-weight:bold>location<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman color:rgb font-weight:bold>media<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>{<spanpalatino linotype new roman>alias<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>home<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>work<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>src<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>sites<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>testdjango1<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>testdjango<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>public<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>media<spanpalatino linotype new roman color:rgb>/<spanpalatino linotype new roman>;<spanpalatino linotype new roman>}<spanpalatino linotype new roman>}</spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino></spanpalatino>
    Copy after login
    在上面的设置后,可以让Nginx来处理静态文件(/static/ 和 /media/ )。非静态文件请求Nginx会发给 socket 8077,然后让uWSGI来进行处理。

    Nginx+uWSGI+Django的实现方式

    在完成上面配置后,需要按以下步骤来做:
  • 重启Nginx服务器,以使Nginx的配置生效。

    nginx -s  reload
    
    Copy after login

    重启后检查Nginx日志是否有异常。

  • 启动uWSGI服务器

    cd /home/work/src/sites/testdjango1/testdjango/mysite
    
    uwsgi -x djangochina_socket.xml
    
    Copy after login

    检查日志 uwsgi.log 是否有异常发现。

  • 访问服务

    基于上面的假设你的域名是www.you.com

    因此,我们访问 www.you.com,如果发现程序与 单独使用Django启动的程序一模一样时,就说明成功啦!

  • 关闭服务的方法

    将uWSGi进程杀死即可。

  • 一些建议

  • uWSG配置文件的进程数,可以根据实际情况分配。不要开得太大,否则机器可能会内存耗用太高。一般来说,对于一个小社区来说,4个进程已经足够了。

  • 一般情况下,可以编写一下 stop.sh 脚本 来关闭uWSGI。

  • 以上就介绍了五步教你实现使用Nginx+uWSGI+Django方法部署Django程序,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    How to configure cloud server domain name in nginx How to configure cloud server domain name in nginx Apr 14, 2025 pm 12:18 PM

    How to configure an Nginx domain name on a cloud server: Create an A record pointing to the public IP address of the cloud server. Add virtual host blocks in the Nginx configuration file, specifying the listening port, domain name, and website root directory. Restart Nginx to apply the changes. Access the domain name test configuration. Other notes: Install the SSL certificate to enable HTTPS, ensure that the firewall allows port 80 traffic, and wait for DNS resolution to take effect.

    How to check whether nginx is started How to check whether nginx is started Apr 14, 2025 pm 01:03 PM

    How to confirm whether Nginx is started: 1. Use the command line: systemctl status nginx (Linux/Unix), netstat -ano | findstr 80 (Windows); 2. Check whether port 80 is open; 3. Check the Nginx startup message in the system log; 4. Use third-party tools, such as Nagios, Zabbix, and Icinga.

    How to create a mirror in docker How to create a mirror in docker Apr 15, 2025 am 11:27 AM

    Steps to create a Docker image: Write a Dockerfile that contains the build instructions. Build the image in the terminal, using the docker build command. Tag the image and assign names and tags using the docker tag command.

    How to check nginx version How to check nginx version Apr 14, 2025 am 11:57 AM

    The methods that can query the Nginx version are: use the nginx -v command; view the version directive in the nginx.conf file; open the Nginx error page and view the page title.

    How to start nginx server How to start nginx server Apr 14, 2025 pm 12:27 PM

    Starting an Nginx server requires different steps according to different operating systems: Linux/Unix system: Install the Nginx package (for example, using apt-get or yum). Use systemctl to start an Nginx service (for example, sudo systemctl start nginx). Windows system: Download and install Windows binary files. Start Nginx using the nginx.exe executable (for example, nginx.exe -c conf\nginx.conf). No matter which operating system you use, you can access the server IP

    How to check whether nginx is started? How to check whether nginx is started? Apr 14, 2025 pm 12:48 PM

    In Linux, use the following command to check whether Nginx is started: systemctl status nginx judges based on the command output: If "Active: active (running)" is displayed, Nginx is started. If "Active: inactive (dead)" is displayed, Nginx is stopped.

    How to start nginx in Linux How to start nginx in Linux Apr 14, 2025 pm 12:51 PM

    Steps to start Nginx in Linux: Check whether Nginx is installed. Use systemctl start nginx to start the Nginx service. Use systemctl enable nginx to enable automatic startup of Nginx at system startup. Use systemctl status nginx to verify that the startup is successful. Visit http://localhost in a web browser to view the default welcome page.

    How to solve nginx403 How to solve nginx403 Apr 14, 2025 am 10:33 AM

    How to fix Nginx 403 Forbidden error? Check file or directory permissions; 2. Check .htaccess file; 3. Check Nginx configuration file; 4. Restart Nginx. Other possible causes include firewall rules, SELinux settings, or application issues.

    See all articles