欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

linux安装nginx make && make install报错解决

程序员文章站 2022-04-19 10:35:36
报错: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 --g...

报错:

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;
        }
    }
}

本文地址:https://blog.****.net/weixin_47632905/article/details/107332854