CentOS 6.8 32位编译安装nginx
2020-07-22 本文已影响0人
青山淼淼
1.使用yum
命令安装相关扩展
yum -y install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl openssl-devel
2.创建服务相关文件夹,并下载nginx
mkdir -p /www/software && cd /www/software && wget https://nginx.org/download/nginx-1.14.0.tar.gz
3.进行文件解压和编译
tar -zxvf nginx-1.14.0.tar.gz
mv nginx-1.14.0 nginxtemp
cd nginxtemp
./configure --prefix=/www/software/nginx --conf-path=/www/software/nginx/nginx.conf --with-http_ssl_module
4.执行完成之后,当面目录会生成一个Makefile
文件,在当前目录进行编译
make && make install
如果出现错误 make[1]: Leaving directory
/www/software/nginx-1.14.0
我重新创建了一个服务器CentOS 7.8 64位 同样的操作就不会有这个错误
可以先不用管它,看看/www/software/nginx是否创建成功且有nginx.
Nginx目录结构应该是这样的
.
├── fastcgi.conf
├── fastcgi.conf.default
├── fastcgi_params
├── fastcgi_params.default
├── html
│ ├── 50x.html
│ └── index.html
├── koi-utf
├── koi-win
├── logs
├── mime.types
├── mime.types.default
├── nginx.conf
├── nginx.conf.default
├── sbin
│ └── nginx
├── scgi_params
├── scgi_params.default
├── uwsgi_params
├── uwsgi_params.default
└── win-utf
5.启动nginx,并测试是否成功
./sbin/nginx
curl -XGET "127.0.0.1"
6.curl捕获到的内容为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 href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>