debian安装nginx_如何在Debian 10上安装Linux,Nginx,MariaDB,PHP(LEMP堆栈)

debian安装nginx

介绍 (Introduction)

The LEMP software stack is a group of software that can be used to serve dynamic web pages and web applications. The name “LEMP” is an acronym that describes a Linux operating system, with an (E)Nginx web server. The backend data is stored in a MariaDB database and the dynamic processing is handled by PHP.

LEMP软件堆栈是一组可用于提供动态网页和Web应用程序的软件。 名称“ LEMP”是描述具有( E )Nginx Web服务器的L inux操作系统的首字母缩写。 后端数据存储在A M ariaDB数据库和动态处理被P HP处理。

Although this software stack typically includes MySQL as the database management system, some Linux distributions — including Debian — use MariaDB as a drop-in replacement for MySQL.

尽管此软件堆栈通常包括MySQL作为数据库管理系统,但某些Linux发行版(包括Debian)使用MariaDB替代MySQL。

In this guide, you’ll install a LEMP stack on a Debian 10 server using MariaDB as the database management system.

在本指南中,您将使用MariaDB作为数据库管理系统,在Debian 10服务器上安装LEMP堆栈。

先决条件 (Prerequisites)

To complete this guide, you will need access to a Debian 10 server. This server should have a regular user configured with sudo privileges and a firewall enabled with ufw. To set this up, you can follow our Initial Server Setup with Debian 10 guide.

要完成本指南,您将需要访问Debian 10服务器。 该服务器应具有配置了sudo特权的常规用户和通过ufw启用的防火墙。 要进行设置,您可以按照Debian 10的初始服务器设置指南进行操作。

第1步-安装Nginx Web服务器 (Step 1 — Installing the Nginx Web Server)

In order to serve web pages to your site visitors, we are going to employ Nginx, a popular web server which is well known for its overall performance and stability.

为了向您的站点访问者提供网页,我们将使用Nginx ,这是一种流行的Web服务器,以其整体性能和稳定性而闻名。

All of the software you will be using for this procedure will come directly from Debian’s default package repositories. This means you can use the apt package management suite to complete the installation.

您将用于此过程的所有软件都将直接来自Debian的默认软件包存储库。 这意味着您可以使用apt软件包管理套件来完成安装。

Since this is the first time you’ll be using apt for this session, you should start off by updating your local package index. You can then install the server:

由于这是您第一次使用apt进行此会话,因此应该从更新本地软件包索引开始。 然后,您可以安装服务器:

  • sudo apt update

    sudo apt更新
  • sudo apt install nginx

    sudo apt安装nginx

On Debian 10, Nginx is configured to start running upon installation.

在Debian 10上,Nginx配置为在安装后开始运行。

If you have the ufw firewall running, you will need to allow connections to Nginx. You should enable the most restrictive profile that will still allow the traffic you want. Since you haven’t configured SSL for your server yet, for now you only need to allow HTTP traffic on port 80.

如果您正在运行ufw防火墙,则需要允许连接到Nginx。 您应启用限制性最强的配置文件,该配置文件仍将允许您所需的流量。 由于尚未为服务器配置SSL,因此现在您只需要允许端口80上的HTTP通信。

You can enable this by typing:

您可以通过键入以下内容启用此功能:

  • sudo ufw allow 'Nginx HTTP'

    sudo ufw允许'Nginx HTTP'

You can verify the change by typing:

您可以通过键入以下内容来验证更改:

  • sudo ufw status

    sudo ufw状态

You should see HTTP traffic allowed in the displayed output:

您应该在显示的输出中看到允许的HTTP流量:


   
   
Output
Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere Nginx HTTP ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) Nginx HTTP (v6) ALLOW Anywhere (v6)

Now, test if the server is up and running by accessing your server’s domain name or public IP address in your web browser. If you do not have a domain name pointed at your server and you do not know your server’s public IP address, you can find it by typing one of the following into your terminal:

现在,通过在Web浏览器中访问服务器的域名或公共IP地址来测试服务器是否已启动并正在运行。 如果您没有指向服务器的域名,并且您不知道服务器的公共IP地址,则可以通过在终端中键入以下内容之一来找到它:

  • ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'

    ip addr显示eth0 | grep inet | awk'{print $ 2; }'| sed's /\/.*$//'

This will print out a few IP addresses. You can try each of them in turn in your web browser.

这将打印出一些IP地址。 您可以依次在网络浏览器中尝试使用它们。

Type one of the addresses that you receive in your web browser. It should take you to Nginx’s default landing page:

键入您在Web浏览器中收到的地址之一。 它应该带您到Nginx的默认登录页面:

http://your_domain_or_IP

If you see the above page, you have successfully installed Nginx.

如果看到上面的页面,则说明您已经成功安装了Nginx。

第2步-安装MariaDB (Step 2 — Installing MariaDB)

Now that you have a web server up and running, you need to install the database system to be able to store and manage data for your site.

现在,您已经启动并运行了Web服务器,您需要安装数据库系统,以便能够存储和管理站点数据。

In Debian 10, the metapackage mysql-server, which was traditionally used to install the MySQL server, was replaced by default-mysql-server. This metapackage references MariaDB, a community fork of the original MySQL server by Oracle, and it’s currently the default MySQL-compatible database server available on debian-based package manager repositories.

在Debian 10中,传统上用于安装MySQL服务器的元软件包mysql-serverdefault-mysql-server取代。 此元包引用了MariaDB ,这是Oracle原始MySQL服务器的社区分支,并且它是当前基于debian的软件包管理器存储库中可用的默认MySQL兼容数据库服务器。

For longer term compatibility, however, it’s recommended that instead of using the metapackage you install MariaDB using the program’s actual package, mariadb-server.

但是,为了获得长期兼容性,建议您不要使用元软件包,而应使用程序的实际软件包mariadb-server安装MariaDB。

To install this software, run:

要安装此软件,请运行:

  • sudo apt install mariadb-server

    sudo apt安装mariadb-server

When the installation is finished, it’s recommended that you run a security script that comes pre-installed with MariaDB. This script will remove some insecure default settings and lock down access to your database system. Start the interactive script by running:

安装完成后,建议您运行随MariaDB预先安装的安全脚本。 该脚本将删除一些不安全的默认设置,并锁定对数据库系统的访问。 通过运行以下命令来启动交互式脚本:

  • sudo mysql_secure_installation

    须藤mysql_secure_installation

This script will take you through a series of prompts where you can make some changes to your MariaDB setup. The first prompt will ask you to enter the current database root password. This is not to be confused with the system root. The database root user is an administrative user with full privileges over the database system. Because you just installed MariaDB and haven’t made any configuration changes yet, this password will be blank, so just press ENTER at the prompt.

该脚本将引导您完成一系列提示,您可以在其中对MariaDB设置进行一些更改。 第一个提示将要求您输入当前的数据库根密码。 这不要与系统根目录混淆。 数据库根用户是对数据库系统具有完全特权的管理用户。 因为您刚刚安装了MariaDB且尚未进行任何配置更改,所以该密码将为空,因此只需在提示符下按ENTER

The next prompt asks you whether you’d like to set up a database root password. Because MariaDB uses a special authentication method for the root user that is typically safer than using a password, you don’t need to set this now. Type N and then press ENTER.

下一个提示询问您是否要设置数据库根密码。 由于MariaDB为用户使用一种特殊的身份验证方法,该方法通常比使用密码更安全,因此您现在无需设置此方法。 键入N ,然后按ENTER

From there, you can press Y and then ENTER to accept the defaults for all the subsequent questions. This will remove anonymous users and the test database, disable remote root login, and load these new rules so that MariaDB immediately respects the changes you have made. When you’re finished, log in to the MariaDB console by typing:

在此处,您可以按Y ,然后按ENTER以接受所有后续问题的默认设置。 这将删除匿名用户和测试数据库,禁用远程root登录,并加载这些新规则,以便MariaDB立即尊重您所做的更改。 完成后,输入以下命令登录到MariaDB控制台:

  • sudo mariadb

    苏多·玛丽亚德

This will connect to the MariaDB server as the administrative database user root, which is inferred by the use of sudo when running this command. You should see output like this:

这将以管理数据库用户root身份连接到MariaDB服务器,这是通过在运行此命令时使用sudo推断出来的。 您应该看到如下输出:


   
   
Output
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 74 Server version: 10.3.15-MariaDB-1 Debian 10 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>

Notice that you didn’t need to provide a password to connect as the root user. That works because the default authentication method for the administrative MariaDB user is unix_socket instead of password. Even though this might look like a security concern at first, it makes the database server more secure because the only users allowed to log in as the root MariaDB user are the system users with sudo privileges connecting from the console or through an application running with the same privileges. In practical terms, that means you won’t be able to use the administrative database root user to connect from your PHP application.

请注意,您无需提供密码即可以root用户身份进行连接。 之所以unix_socket ,是因为管理MariaDB用户的默认身份验证方法是unix_socket而不是password 。 即使最初看起来像是一个安全问题,它仍使数据库服务器更加安全,因为唯一允许以root MariaDB用户身份登录的用户是具有sudo特权的系统用户,这些用户从控制台或通过运行该命令的应用程序进行连接相同的特权。 实际上,这意味着您将无法使用管理数据库用户从PHP应用程序进行连接。

For increased security, it’s best to have dedicated user accounts with less expansive privileges set up for every database, especially if you plan on having multiple databases hosted on your server. To demonstrate such a setup, we’ll create a database named example_database and a user named example_user, but you can replace these names with different values. To create a new database, run the following command from your MariaDB console:

为了提高安全性,最好为每个数据库设置专用的用户帐户,并为其设置较少的扩展特权,尤其是如果您计划在服务器上托管多个数据库时。 为了演示这种设置,我们将创建一个名为example_database的数据库和一个名为example_user的用户,但是您可以将这些名称替换为不同的值。 要创建一个新数据库,请从您的MariaDB控制台运行以下命令:

  • CREATE DATABASE example_database;

    创建数据库example_database ;

Now you can create a new user and grant them full privileges on the custom database you’ve just created. The following command defines this user’s password as password, but you should replace this value with a secure password of your own choosing.

现在,您可以创建一个新用户,并向他们授予您刚创建的自定义数据库的全部特权。 以下命令将该用户的密码定义为password ,但是您应使用自己选择的安全密码替换此值。

  • GRANT ALL ON example_database.* TO 'example_user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

    将所有内容都授予example_database 。*到' example_user '@'localhost'由' password '加上GRANT OPTION标识;

This will give the example_user user full privileges over the example_database database, while preventing this user from creating or modifying other databases on your server.

这将为example_user用户提供对example_database数据库的完全特权,同时阻止该用户在服务器上创建或修改其他数据库。

Flush the privileges to ensure that they are saved and available in the current session:

刷新特权以确保它们已保存并在当前会话中可用:

  • FLUSH PRIVILEGES;

    冲洗特权;

Following this, exit the MariaDB shell:

之后,退出MariaDB shell:

  • exit

    出口

You can test if the new user has the proper permissions by logging in to the MariaDB console again, this time using the custom user credentials:

您可以使用自定义用户凭据再次登录到MariaDB控制台,以测试新用户是否具有适当的权限:

  • mariadb -u example_user -p

    mariadb -u example_user -p

Note the -p flag in this command, which will prompt you for the password used when creating the example_user user. After logging in to the MariaDB console, confirm that you have access to the example_database database:

注意此命令中的-p标志,它将提示您输入创建example_user用户时使用的密码。 登录到MariaDB控制台后,请确认您有权访问example_database数据库:

  • SHOW DATABASES;

    显示数据库;

This will give you the following output:

这将为您提供以下输出:


   
   
Output
+--------------------+ | Database | +--------------------+ | example_database | | information_schema | +--------------------+ 2 rows in set (0.000 sec)

To exit the MariaDB shell, type:

要退出MariaDB shell,请输入:

  • exit

    出口

At this point, your database system is set up and you can move on to installing PHP, the final component of the LEMP stack.

至此,您的数据库系统已经建立,您可以继续安装PHP,它是LEMP堆栈的最后一个组件。

第3步-安装PHP进行处理 (Step 3 — Installing PHP for Processing)

You have Nginx installed to serve your content and MySQL installed to store and manage your data. Now you can install PHP to process code and generate dynamic content for the web server.

您已经安装了Nginx来提供内容,并安装了MySQL以存储和管理数据。 现在,您可以安装PHP来处理代码并为Web服务器生成动态内容。

While Apache embeds the PHP interpreter in each request, Nginx requires an external program to handle PHP processing and act as bridge between the PHP interpreter itself and the web server. This allows for a better overall performance in most PHP-based websites, but it requires additional configuration. You’ll need to install php-fpm, which stands for “PHP fastCGI process manager”, and tell Nginx to pass PHP requests to this software for processing. Additionally, you’ll need php-mysql, a PHP module that allows PHP to communicate with MySQL-based databases. Core PHP packages will automatically be installed as dependencies.

虽然Apache在每个请求中都嵌入了PHP解释器,但Nginx需要一个外部程序来处理PHP处理并充当PHP解释器本身和Web服务器之间的桥梁 。 这可以在大多数基于PHP的网站中提供更好的整体性能,但是需要其他配置。 您需要安装php-fpm ,它代表“ PHP fastCGI进程管理器”,并告诉Nginx将PHP请求传递给该软件进行处理。 此外,您将需要php-mysql ,这是一个允许PHP与基于MySQL的数据库进行通信PHP模块。 核心PHP软件包将自动安装为依赖项。

To install the php-fpm and php-mysql packages, run:

要安装php-fpmphp-mysql软件包,请运行:

  • sudo apt install php-fpm php-mysql

    须藤apt安装php-fpm php-mysql

You now have your PHP components installed. Next, you’ll configure Nginx to use them.

现在,您已经安装了PHP组件。 接下来,您将配置Nginx以使用它们。

第4步-配置Nginx使用PHP处理器 (Step 4 — Configuring Nginx to Use the PHP Processor)

When using the Nginx web server, server blocks (similar to virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain on a single server. In this guide, we’ll use your_domain as example domain name. To learn more about setting up a domain name with DigitalOcean, see our introduction to DigitalOcean DNS.

使用Nginx Web服务器时, 服务器块 (类似于Apache中的虚拟主机)可用于封装配置详细信息,并在一台服务器上托管多个域。 在本指南中,我们将使用your_domain作为示例域名。 要了解有关使用DigitalOcean设置域名的更多信息,请参阅DigitalOcean DNS简介

On Debian 10, Nginx has one server block enabled by default and is configured to serve documents out of a directory at /var/www/html. While this works well for a single site, it can become difficult to manage if you are hosting multiple sites. Instead of modifying /var/www/html, let’s create a directory structure within /var/www for the your_domain website, leaving /var/www/html in place as the default directory to be served if a client request doesn’t match any other sites.

在Debian 10上,Nginx默认情况下启用了一个服务器块,并配置为从/var/www/html目录中提供文档。 尽管这对于单个站点非常有效,但是如果您托管多个站点,则可能变得难以管理。 而不是修改的/var/www/html ,让我们创建中的目录结构/var/www您的网域网站,留下/var/www/html作为如果客户端的请求不符合任何要服务的默认目录的地方其他网站。

Create the root web directory for your_domain as follows:

your_domain创建根Web目录,如下所示:

  • sudo mkdir /var/www/your_domain

    须藤mkdir / var / www / your_domain

Next, assign ownership of the directory with the $USER environment variable, which should reference your current system user:

接下来,使用$ USER环境变量分配目录的所有权,该变量应引用您当前的系统用户:

  • sudo chown -R $USER:$USER /var/www/your_domain

    须藤chown -R $ USER:$ USER / var / www / your_domain

Then, open a new configuration file in Nginx’s sites-available directory using your preferred command-line editor. Here, we’ll use nano:

然后,使用首选的命令行编辑器在Nginx的sites-available目录中打开一个新的配置文件。 在这里,我们将使用nano

  • sudo nano /etc/nginx/sites-available/your_domain

    须藤纳米/ etc / nginx / sites-available / your_domain

This will create a new blank file. Paste in the following bare-bones configuration:

这将创建一个新的空白文件。 粘贴以下基本配置:

/etc/nginx/sites-available/your_domain
/ etc / nginx / sites-available / your_domain
server {
    listen 80;
    listen [::]:80;

    root /var/www/your_domain;
    index index.php index.html index.htm;

    server_name your_domain;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    }
}

This is a basic configuration that listens on port 80 and serves files from the web root you just created. It will only respond to requests to the host or IP address provided after server_name, and any files ending in .php will be processed by php-fpm before Nginx sends the results to the user.

这是一个基本配置,它侦听端口80并从刚创建的Web根目录提供文件。 它只会响应对server_name之后提供的主机或IP地址的请求,在Nginx将结果发送给用户之前,任何以.php结尾的.php都将由php-fpm处理。

When you’re done editing, save and close the file. If you used nano to create the file, do so by typing CTRL+X and then y and ENTER to confirm.

完成编辑后,保存并关闭文件。 如果您使用nano来创建文件,请键入CTRL + X ,然后按yENTER进行确认。

Activate your configuration by linking to the config file from Nginx’s sites-enabled directory:

通过链接到Nginx sites-enabled目录中的配置文件来激活您的配置:

  • sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/

    sudo ln -s / etc / nginx / sites-available / your_domain / etc / nginx / sites-enabled /

This will tell Nginx to use the configuration next time it is reloaded. You can test your configuration for syntax errors by typing:

这将告诉Nginx在下次重新加载时使用配置。 您可以通过键入以下内容来测试配置中的语法错误:

  • sudo nginx -t

    须藤Nginx -t

If any errors are reported, go back to your configuration file to review its contents before continuing.

如果报告了任何错误,请在继续操作之前返回到配置文件以检查其内容。

When you are ready, reload Nginx to make the changes:

准备好后,重新加载Nginx进行更改:

  • sudo systemctl reload nginx

    须藤systemctl重新加载nginx

Next, you’ll create a file in your new web root directory to test out PHP processing.

接下来,您将在新的Web根目录中创建一个文件以测试PHP处理。

步骤5 —创建一个PHP文件以测试配置 (Step 5 — Creating a PHP File to Test Configuration)

Your LEMP stack should now be completely set up. You can test it to validate that Nginx can correctly hand .php files off to your PHP processor.

您的LEMP堆栈现在应该已完全设置。 您可以对其进行测试,以验证Nginx是否可以将.php文件正确地传递给您PHP处理器。

You can do this by creating a test PHP file in your document root. Open a new file called info.php within your document root in your text editor:

您可以通过在文档根目录中创建一个测试PHP文件来实现。 在文本编辑器的文档根目录中打开一个名为info.php的新文件:

  • nano /var/www/your_domain/info.php

    纳米/ var / www / your_domain /info.php

Type or paste the following lines into the new file. This is valid PHP code that will return information about your server:

将以下行键入或粘贴到新文件中。 这是有效PHP代码,它将返回有关您的服务器的信息:

/var/www/your_domain/info.php
/var/www/your_domain/info.php
<?php
phpinfo();
?>

When you are finished, save and close the file by typing CTRL+X and then y and ENTER to confirm.

完成后,通过键入CTRL + X ,然后按yENTER进行保存并关闭文件。

You can now access this page in your web browser by visiting the domain name or public IP address you’ve set up in your Nginx configuration file, followed by /info.php:

现在,您可以在Web浏览器中访问此页面,方法是访问在Nginx配置文件中设置的域名或公共IP地址,然后/info.php

http://your_domain/info.php

You will see a web page containing detailed information about your server:

您将看到一个包含有关服务器的详细信息的网页:

After checking the relevant information about your PHP server through that page, it’s best to remove the file you created as it contains sensitive information about your PHP environment and your Debian server. You can use rm to remove that file:

在通过该页面检查有关PHP服务器的相关信息之后,最好删除您创建的文件,因为该文件包含有关PHP环境和Debian服务器的敏感信息。 您可以使用rm删除该文件:

  • rm /var/www/your_domain/info.php

    rm / var / www / your_domain /info.php

You can always regenerate this file if you need it later. Next, we’ll test the database connection from the PHP side.

如果以后需要,可以随时重新生成该文件。 接下来,我们将从PHP端测试数据库连接。

第6步-从PHP测试数据库连接(可选) (Step 6 — Testing Database Connection from PHP (Optional))

If you want to test if PHP is able to connect to MariaDB and execute database queries, you can create a test table with dummy data and query for its contents from a PHP script.

如果要测试PHP是否能够连接到MariaDB并执行数据库查询,则可以创建一个包含伪数据的测试表,并从PHP脚本中查询其内容。

First, connect to the MariaDB console with the database user you created in Step 2 of this guide:

首先,使用您在本指南的步骤2中创建的数据库用户连接到MariaDB控制台:

  • mariadb -u example_user -p

    mariadb -u example_user -p

Create a table named todo_list. From the MariaDB console, run the following statement:

创建一个名为todo_list的表。 在MariaDB控制台中,运行以下语句:

CREATE TABLE example_database.todo_list (
    item_id INT AUTO_INCREMENT,
    content VARCHAR(255),
    PRIMARY KEY(item_id)
);

Now, insert a few rows of content in the test table. You might want to repeat the next command a few times, using different values:

现在,在测试表中插入几行内容。 您可能需要使用不同的值重复执行下一条命令几次:

  • INSERT INTO example_database.todo_list (content) VALUES ("My first important item");

    插入INTO example_database 。 todo_list (内容)VALUES(“ 我的第一个重要项目 ”);

To confirm that the data was successfully saved to your table, run:

要确认数据已成功保存到表中,请运行:

  • SELECT * FROM example_database.todo_list;

    SELECT * FROM example_database 。 todo_list ;

You will see the following output:

您将看到以下输出:


   
   
Output
+---------+--------------------------+ | item_id | content | +---------+--------------------------+ | 1 | My first important item | | 2 | My second important item | | 3 | My third important item | | 4 | and this one more thing | +---------+--------------------------+ 4 rows in set (0.000 sec)

After confirming that you have valid data in your test table, you can exit the MariaDB console:

在确认测试表中有有效数据之后,可以退出MariaDB控制台:

  • exit

    出口

Now you can create the PHP script that will connect to MariaDB and query for your content. Create a new PHP file in your custom web root directory using your preferred editor. We’ll use nano for that:

现在,您可以创建将连接到MariaDB并查询您内容PHP脚本。 使用首选编辑器在自定义Web根目录中创建一个新PHP文件。 我们将为此使用nano

  • nano /var/www/your_domain/todo_list.php

    纳米/ var / www / your_domain / todo_list.php

Add the following content to your PHP script:

将以下内容添加到您PHP脚本中:

<?php
$user = "example_user";
$password = "password";
$database = "example_database";
$table = "todo_list";

try {
  $db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
  echo "<h2>TODO</h2><ol>"; 
  foreach($db->query("SELECT content FROM $table") as $row) {
    echo "<li>" . $row['content'] . "</li>";
  }
  echo "</ol>";
} catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
}

Save and close the file when you’re done editing.

完成编辑后,保存并关闭文件。

You can now access this page in your web browser by visiting the domain name or public IP address you’ve set up in your Nginx configuration file, followed by /todo_list.php:

现在,您可以在Web浏览器中访问此页面,方法是访问在Nginx配置文件中设置的域名或公共IP地址,然后/todo_list.php

http://your_domain/todo_list.php

You should see a page like this, showing the content you’ve inserted in your test table:

您应该看到这样的页面,显示您已插入测试表中的内容:

That means your PHP environment is ready to connect and interact with your MariaDB server.

这意味着您PHP环境已准备就绪,可以连接MariaDB服务器并与之交互。

结论 (Conclusion)

In this guide, you’ve built a flexible foundation for serving PHP websites and applications to your visitors, using Nginx as web server. You’ve set up Nginx to handle PHP requests through php-fpm, and you also set up a MariaDB database to store your website’s data.

在本指南中,您使用Nginx作为Web服务器,为为访问者提供PHP网站和应用程序奠定了灵活的基础。 您已经设置了Nginx来通过php-fpm处理PHP请求,并且还设置了一个MariaDB数据库来存储您的网站数据。

To further improve your current setup, you can install Composer for dependency and package management in PHP, and you can also install an OpenSSL certificate for your website using Let’s Encrypt.

为了进一步改善当前设置,您可以在PHP中安装Composer进行依赖关系和程序包管理,还可以使用Let's Encrypt为您的网站安装OpenSSL证书

翻译自: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mariadb-php-lemp-stack-on-debian-10

debian安装nginx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值