• Linux-RedHat7.2 安装nginx托管.net core2.0


    1、安装依赖包

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

    2、下载安装包

    wget http://nginx.org/download/nginx-1.13.5.tar.gz

    3、解压

    mkdir nginxfiles
    tar -zxvf nginx-1.13.5.tar.gz -C nginxfiles

    4、切换目录

    cd nginxfiles/
    cd nginx-1.13.5/

    5、配置

    ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-stream --with-mail=dynamic

    6、编译、安装

    make
    make install

    7、创建软链接

    ln -s /usr/local/nginx/sbin/nginx /usr/local/bin 

    8、查看安装状态

    cd /
    nginx -v

    9、托管.net core 应用

    vim /usr/local/nginx/conf/nginx.conf
      location / {
                root   html;
                index  index.html index.htm;
            }
    
    修改为:
    
      location / {
                proxy_pass http://127.0.0.1:5000;
                proxy_set_header Connection "";
                proxy_http_version 1.1;
                root   html;
                index  index.html index.htm;
            }

    10、设置开机启动

    vim /lib/systemd/system/nginx.service
    --内容如下:
    
    [Unit]
    Description=nginx - high performance web server
    After=network.target remote-fs.target nss-lookup.target
    
    [Service]
    Type=forking
    ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    ExecReload=/usr/local/nginx/sbin/nginx -s reload
    ExecStop=/usr/local/nginx/sbin/nginx -s stop
    
    [Install]
    WantedBy=multi-user.target
    systemctl enable nginx.service
    # 启动nginx服务
    systemctl start nginx.service
    # 查看状态
    systemctl status nginx.service
    
    # 如果修改了文件,这个是必须的
    systemctl daemon-reload
    # 重新启动服务
    systemctl restart nginx.service

    11、使用ip访问(80端口)

    ifconfig -a

  • 相关阅读:
    LeetCode 209. 长度最小的子数组(Minimum Size Subarray Sum)
    LeetCode 快乐数(Happy Number)
    Deep & Cross Network总结
    CTR预估之LR与GBDT融合
    近似最近邻算法-annoy解析
    FM与FFM深入解析
    LeetCode 222. 完全二叉树的节点个数(Count Complete Tree Nodes)
    js 时间与时间戳的转换
    table 样式美化
    c# string 和 byte[]数组之间转换
  • 原文地址:https://www.cnblogs.com/kuangxiangnice/p/9597548.html
Copyright © 2020-2023  润新知