centos系统 make nginx 没有sbin目录
时间: 2024-02-11 18:05:16 浏览: 42
在 CentOS 系统中编译安装 Nginx 后,其可执行文件默认会安装在 `/usr/local/nginx` 目录下,而不是 `/usr/sbin` 目录下。
如果你想要在命令行中直接使用 Nginx 命令,可以将 `/usr/local/nginx/sbin` 目录添加到 PATH 环境变量中,或者使用完整路径来执行 Nginx 命令。
例如,如果你想要启动 Nginx,可以使用以下命令:
```
/usr/local/nginx/sbin/nginx
```
如果你想要将 `/usr/local/nginx/sbin` 目录添加到 PATH 环境变量中,可以在 `~/.bashrc` 文件中添加以下行:
```
export PATH=/usr/local/nginx/sbin:$PATH
```
保存文件后,执行以下命令使配置生效:
```
source ~/.bashrc
```
这样,你就可以在命令行中直接使用 `nginx` 命令来启动、停止和重启 Nginx 了。
相关问题
centos 7.9 安装nginx
以下是在CentOS 7.9上安装Nginx的步骤:
1.安装GCC环境
```shell
yum install -y gcc
```
2.下载Nginx
```shell
wget http://nginx.org/download/nginx-1.22.0.tar.gz
```
3.解压缩Nginx
```shell
tar -zxvf nginx-1.22.0.tar.gz
```
4.安装PCRE库
```shell
yum install -y pcre pcre-devel
```
5.安装zlib库
```shell
yum install -y zlib zlib-devel
```
6.安装OpenSSL库
```shell
yum install -y openssl openssl-devel
```
7.进入Nginx目录并配置
```shell
cd nginx-1.22.0
./configure
```
8.编译并安装Nginx
```shell
make
make install
```
9.启动Nginx
```shell
/usr/local/nginx/sbin/nginx
```
centos8 安装nginx
在CentOS 8上安装Nginx的步骤如下:
1. 首先,下载Nginx的安装包。可以使用以下命令下载最新的稳定版本:
```
wget -c https://nginx.org/download/nginx-1.12.0.tar.gz
```
2. 下载完成后,解压安装包并进入解压后的目录:
```
tar -zxvf nginx-1.12.0.tar.gz
cd nginx-1.12.0
```
3. 安装Nginx所需的依赖库。在CentOS 8上,可以使用以下命令安装所需的依赖库:
```
yum install -y gcc pcre-devel openssl-devel
```
4. 执行配置命令以配置Nginx的编译参数:
```
./configure
```
5. 编译并安装Nginx:
```
make
make install
```
6. 安装完成后,可以使用以下命令启动、停止或重启Nginx:
```
cd /usr/local/nginx/sbin/
启动:./nginx
停止:./nginx -s stop
退出:./nginx -s quit
重启:./nginx -s reload
```
请注意,以上命令中的路径可能会因个人安装的不同而有所变化,如果路径不同,请根据实际情况修改路径。 <span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [centos8安装nginx](https://blog.csdn.net/m0_55390780/article/details/119677449)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [Centos 8 安装 nginx](https://blog.csdn.net/qq_59636442/article/details/123936647)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)