nginx安装linx
时间: 2024-06-01 10:06:29 浏览: 188
安装nginx非常简单,你只需要在终端中执行以下命令即可:
```
sudo apt update
sudo apt install nginx
```
这将会安装最新的nginx版本并启动nginx服务。你可以通过以下命令检查nginx是否已经成功安装:
```
systemctl status nginx
```
如果nginx已经启动,你应该会看到类似于以下输出:
```
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-12-31 07:34:31 UTC; 3h 25min ago
Docs: man:nginx(8)
Process: 4170 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 4163 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 4171 (nginx)
Tasks: 2 (limit: 2361)
Memory: 4.5M
CGroup: /system.slice/nginx.service
├─4171 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─4172 nginx: worker process
Dec 31 07:34:31 ubuntu systemd: Starting A high performance web server and a reverse proxy server...
Dec 31 07:34:31 ubuntu systemd: Started A high performance web server and a reverse proxy server.
```
如果nginx没有启动,你可以使用以下命令启动它:
```
sudo systemctl start nginx
```
阅读全文