nginx的编译安装

nginx 的编译安装

1. 准备

下载地址:https://nginx.org/en/download.html

linux服务器环境

2. 安装

2.1 解压并进入源码目录

tar -zxvf nginx-1.24.0.tar.gz

cd nginx-1.24.0.tar.gz

2.2 安装 nginx编译时所需的依赖库

yum -y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel

2.3 编译nginx,指定安装路径

./configure --prefix=/data/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream=dynamic

2.4 安装

make

make install

3. 启动

cd /data/nginx

sbin/nginx

4. 其他命令

测试: sbin/nginx -t

重载: sbin/nginx -reload

5. 代理配置

新建配置文件夹,后续配置文件都存放在这里

mkdir conf.d

修改配置文件引入,使文件夹的文件生效

cd conf

vim nginx.conf

在 http {} 配置中的尾部,追加(一般为倒数第二行)

include /data/nginx/conf.d/*.conf;

新增简易代理配置

cd /data/nginx/conf.d

touch tomcat.conf

vim tomcat.conf

server {
        listen 9090;

        location / {
                proxy_pass http://localhost:8080;
        }
}

你可能感兴趣的:(nginx,nginx)