Centos7安裝Nginx


1.安裝nginx

#pm -ivh http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.10.2-1.el7.ngx.x86_64.rpm

備注:其實根據上面這個網址(http://nginx.org/packages/)可以進去其nginx官方的的包管理列表,選擇合適的系統和包

2.啟動nginx

# systemctl start nginx
// 驗證是否啟動成功

# curl http://127.0.0.1:80   // 正常會返回html代碼

或者可以使用

#ps -ef | grep nginx  //正常會返回多個nginx相關的信息,沒啟動則返回一個

啟動了:

[root@localhost ~]# ps -ef | grep nginx
root 955 1 0 18:55 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx 959 955 0 18:55 ? 00:00:00 nginx: worker process
root 2115 2053 0 18:56 pts/0 00:00:00 grep --color=auto nginx

沒啟動:

[root@localhost ~]# ps -ef | grep nginx
root 2128 2053 0 18:56 pts/0 00:00:00 grep --color=auto nginx

3.設置nginx開機啟動

# systemctl enable nginx

4.nginx常用操作

// 服務狀態
# systemctl status nginx
// 服務啟動
# systemctl start nginx
// 服務停止
# systemctl stop nginx
// 服務重啟
# systemctl restart nginx

5.相關路徑

//nginx路徑

/usr/sbin/nginx

//nginx配置文件路徑

/etc/nginx/conf.d/default.conf

---轉自 https://www.cnblogs.com/EasonJim/p/9020896.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM