Nginx在CentOS上的安装

--------------------------先下载Nginx需要的依赖----------------------------------------------

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

mkdir /opt/nginx-source

mkdir /opt/nginx

-------------------------在/opt/nginx-source中下载源码-------------------------------------

cd  /opt/nginx-source
wget http://nginx.org/download/nginx-1.13.11.tar.gz
tar zxvf nginx-1.13.11.tar.gz

-------------------------解析Nginx源码包,输出到/opt/nginx目录下-----------------------------------

cd /opt/nginx-source/nginx-1.13.11
./configure --prefix=/opt/nginx
make
make install

./nginx -s stop #立即停止

./nginx -s quit  #安全停止

./nginx -s reload #重启

./nginx   # 启动

 

下面的配置是用80端口代理本机的8080端口

server {
        listen       80;
        server_name  localhost;

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

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        #location / {
        #   root   html;
        #   index  index.html index.htm;
        #}
}

posted @   小大宇  阅读(10)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
点击右上角即可分享
微信分享提示