记录软件包安装nginx的依赖问题

采用安装包进行安装

  • useradd leyou

  • cd /home/leyou

  • 上传文件到/home/leyou

  • 本机上传到服务器可采用 scp -r nginx所在本地目录 服务器目录地址

    ​ eg: scp -r D://test/nginx-1.10.0.tar.gz root@192.168.43.32:/home/leyou

  • 解压tar xvf nginx-1.10.0.tar.gz

  • 进入 nginx-1.10.0目录 cd /home/leyou

  • ./configure --prefix=/opt/nginx --sbin-path=/usr/bin/nginx

  • make && make install 成功后的最后面的一句话make[1]: Leaving directory /home/leyou/nginx-1.10.0

出现的问题及解决的办法:

  • yum -y install gcc gcc-c++ autoconf automake make
checking for OS
 + Linux 3.10.0-1062.el7.x86_64 x86_64
checking for C compiler ... not found

./configure: error: C compiler cc is not found
  • yum -y install pcre-devel
./configure: error: the HTTP gzip module requires the pcre rary.
  • yum install -y zlib-devel
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using –without-http_gzip_module
option, or install the zlib library into the system, or build the zlib 
library
statically from the source with nginx by using –with-zlib=<path> option.
  • nginx(如果80端口被占用则开启不了)
  • 查看服务 ps -ef | grep nginx
root      7787     1  0 16:32 ?        00:00:00 nginx: master process nginx
nobody    7788  7787  0 16:32 ?        00:00:00 nginx: worker process
root      7790  1795  0 16:32 pts/0    00:00:00 grep --color=auto nginx
  • kill -9 进程号 杀死

nginx的配置:

server {
    listen		80;
    server_name manage.leyou.com;
    
    proxy_set_header X-Forworded-Host $host;
    proxy_set_header X-Forworded-Server $host;
    proxy_set_header X-Forworded-For $proxy_add_x_forwarded_for;
    
    location / {
        proxy_pass http://192.168.43.30:9001; //拦截并代理到一个你指定的网址 
        proxy_connect_timeout 600;
        proxy_read_timeout 600;
    }
}
  • nginx -s reload 重启nginx

nginx在root目录下访问文件:

user root;    //使用用户的权限----第一行 


		#前端
        location / {
                #解决请求头失效
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                root   /root/ybx/dist;
                try_files $uri $uri/ /index.html;
                index  index.html index.htm;

        }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值