报错:
make: *** No rule to make target `build', needed by `default'. Stop.
解决:
跟新yum:
yun update
删除原先解压的nginx重新解压一份
添加依赖的库:
yum install -y gcc pcre pcre-devel openssl openssl-devel gd gd-devel
参数编译:
./configure --prefix=/data/nginx-1.16.1 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module
添加用户:
useradd nginx -M -s /sbin/nologin
编译:
make && make install
软连接:
ln -s /data/nginx-1.16.1 /data/nginx
测试nginx配置文件是否正常
/data/nginx/sbin/nginx -t
启动nginx:
/data/nginx/sbin/nginx ##确定nginx服务
netstat -lntup |grep nginx ## 检查进程是否正常
curl http://localhost ## 确认结果
nginx配置文件:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}