暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Debian镜像的使用和Nginx的安装

云自由 2023-09-15
164

一、查看debian版本

zhangsan@debian:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:   Debian GNU/Linux 11 (bullseye)
Release:       11
Codename:       bullseye
复制

系统当前版本是Debian11(bullseye)

二、编辑/etc/apt/sources.list文件

在文件最前面添加以下条目(操作前请做好相应备份)

zhangsan@debian:~$ sudo vi etc/apt/sources.list
[sudo] password for zhangsan:
复制

Debian10(Buster) 以上版本默认支持 HTTPS 源。

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
复制

三、Nginx的安装

1.更新系统软件包列表:

sudo apt update

2.安装Nginx:

sudo apt install nginx在安装过程中,系统会要求您确认安装。按下"Y"键并按Enter继续。

3.安装完成后,可以使用以下命令启动Nginx服务:

sudo systemctl start nginx

4.可以使用以下命令检查Nginx服务的状态:

sudo systemctl status nginx

如果一切正常,您将看到Nginx服务正在运行。

四、端口被占用的情况

如果提示Not attempting to start NGINX, port 80 is already in use.

查看端口占用情况

sudo netstat -apn|grep 80

发现是apache2正在使用80端口

tcp6       0      0 :::80                   :::*                    LISTEN      557/apache2  
复制

停止apache2服务

sudo systemctl stop apache2



文章转载自云自由,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论