Linux 安装nginx

什么是Nginx服务器
一个高性能的HTTP和反向代理web服务器

1.nginx下载

 2.上传

//上传
[root@xiaobing software]# rz -E
rz waiting to receive.
[root@xiaobing software]# ls
nginx-1.13.7.tar.gz
//解压
[root@xiaobing software]# tar -zxvf nginx-1.13.7.tar.gz 
//重命名
[root@xiaobing software]# mv nginx-1.13.7 nginx
[root@xiaobing software]# ls
nginx

3.安装依赖 yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

4.nginx安装

//执⾏行行命令
./configure
make
make install

make 遇到错误:

 解决问题:

cd /usr/local/software/nginx/src/os/unix
[root@xiaobing unix]# vim ngx_user.c
//修改前
#ifdef __GLIBC__
    /* work around the glibc bug */
    cd.current_salt[0] = ~salt[0];
#endif
//修改后
#ifdef __GLIBC__
    /* work around the glibc bug */
    /* cd.current_salt[0] = ~salt[0];*/
#endif
//重新make问题解决
//最后一步:
//将对应的makefile文件夹中(如本文中在 /nginx/objs/Makefile) 找到 -Werrori 并去掉 
//修改前
CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g
//修改后
CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -g

5.执行完安装命令后启动nginx

cd /usr/local/nginx/sbin
[root@xiaobing sbin]# ./nginx

6.公网IP:80

7.查看访问日志 /usr/local/nginx/logs

原文地址:https://www.cnblogs.com/xiaozhaoboke/p/15772198.html