[Nginx] 安裝網頁伺服器Nginx (CentOS8.2)
相較於Apache,Nginx消耗資源少,處理速度快,是大流量應用的較好的選擇。
(環境:CentOS8.2)
- 開啟Terminal,使用「dnf」來安裝「Nginx」
- 「Nginx」預設是沒有開啟的,重新開機也不會自動開啟,所以下指令
[user@localhost ~]$ sudo systemctl start nginx #現在馬上開啟nginx服務 [user@localhost ~]$ sudo systemctl enable nginx #之後開機也要自動開啟nginx服務
- 確認 nginx 的服務狀態
[user@localhost ~]$ sudo systemctl status nginx ● nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2020-09-10 09:08:10 CST; 3min 51s ago Process: 2892 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS) Process: 2890 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS) Process: 2888 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS) Main PID: 2893 (nginx) Tasks: 3 (limit: 49448) Memory: 5.7M CGroup: /system.slice/nginx.service ├─2893 nginx: master process /usr/sbin/nginx ├─2894 nginx: worker process └─2895 nginx: worker process Sep 10 09:08:10 localhost.localdomain systemd[1]: Starting The nginx HTTP and reverse proxy server... Sep 10 09:08:10 localhost.localdomain nginx[2890]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok Sep 10 09:08:10 localhost.localdomain nginx[2890]: nginx: configuration file /etc/nginx/nginx.conf test is successful Sep 10 09:08:10 localhost.localdomain systemd[1]: Started The nginx HTTP and reverse proxy server.
[user@localhost ~]$ sudo dnf install -y nginx ... ... ... Complete! #看到這就行代表完成
留言
張貼留言