網(wǎng)站首頁(yè) 編程語(yǔ)言 正文
安裝網(wǎng)址
http://nginx.org/en/download.html
安裝依賴包
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
下載Nginx并解壓安裝包
//下載tar包之前,前提安裝wget
yum install wget
//創(chuàng)建文件
mkdir -p/usr/local/nginx
//下載安裝包 安裝包可以根據(jù)自己的需求修改,上面提到的安裝網(wǎng)址,選擇合適的路徑添加
wget http://nginx.org/download/nginx-1.18.0.tar.gz
//解壓文件夾
tar -xvf nginx-1.18.0.tar.gz
安裝
//執(zhí)行命令
./configure --prefix=/usr/local/nginx
//執(zhí)行make命令
make
//執(zhí)行make install命令
make install
查看安裝版本號(hào)
/cd sbin
./nginx -v
檢查配置文件正確性
./nginx -v
啟動(dòng)Nginx服務(wù)
./nginx
停止Nginx服務(wù)
./nginx -s stop
啟動(dòng)完成后查看Nginx進(jìn)程
ps -ef | grep nginx
[root@localhost sbin]# ps -ef | grep nginx
root 7004 1 0 12:30 ? 00:00:00 nginx: master process ./nginx
nobody 7005 7004 0 12:30 ? 00:00:00 nginx: worker process
root 7014 1297 0 12:31 pts/0 00:00:00 grep --color=auto nginx
確認(rèn)ip地址
[root@localhost html]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:8b:5d:72 brd ff:ff:ff:ff:ff:ff
inet 192.168.179.130/24 brd 192.168.179.255 scope global noprefixroute dynamic ens33
valid_lft 1439sec preferred_lft 1439sec
inet6 fe80::17be:75e1:b84:e7af/64 scope link noprefixroute
valid_lft forever preferred_lft forever
關(guān)閉防火墻
防火墻不關(guān)閉,無(wú)法顯示登錄的頁(yè)面,需要先關(guān)閉防火墻
systemctl stop firewalld
剛確認(rèn)的ip地址輸入到游覽器
http://192.168.179.130/
[root@localhost html]# systemctl stop firewalld
[root@localhost html]# cat index.html
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a >nginx.org</a>.<br/>
Commercial support is available at
<a >nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
nginx配置文件修改
vim /usr/local/nginx/conf/nginx.conf
修改后重啟
[root@localhost conf]# nginx -s reload
補(bǔ)充:
每次從nginx路徑下在啟動(dòng)文件比較麻煩,直接在路徑下直接啟動(dòng)。
方法如下:
nginx的配置路徑修改
[root@localhost /]# vim /etc/profile
[root@localhost /]# source /etc/profile
重新加載配置文件
[root@localhost /]#./nginx -s reload
原文鏈接:https://blog.csdn.net/weixin_45428910/article/details/127033407
相關(guān)推薦
- 2022-05-11 linq中的連接操作符_實(shí)用技巧
- 2022-11-25 Linux?apache實(shí)現(xiàn)https的配置方法_Linux
- 2022-02-16 小div在大div中水平垂直居中(兩個(gè)div都固定寬高)
- 2022-08-29 C#中Attribute特性的用法_C#教程
- 2022-08-26 Jquery實(shí)現(xiàn)下拉菜單案例_jquery
- 2023-01-19 Yolov5更換BiFPN的詳細(xì)步驟總結(jié)_python
- 2022-05-15 asyncio異步編程之Task對(duì)象詳解_python
- 2022-12-25 C++?Boost?Accumulators累加器詳細(xì)講解_C 語(yǔ)言
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過(guò)濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支