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

最新文章

  1. erlang 在线生成crashdump
  2. 【生活没有希望】poj1273网络流大水题
  3. 使用dedecms中常见错误提示及解决办法(一)
  4. POJ 1308
  5. tensor
  6. 第12条:考虑实现Comparable接口
  7. python 自动化之路 day 01 人生若只如初见
  8. 【HDOJ】3560 Graph’s Cycle Component
  9. JS之路——数组对象
  10. windows应用中调用DLL一步步试验
  11. iBatis2之SqlMap配置总结(18条)
  12. django框架介绍
  13. Android Studio 打包流程
  14. UNITY使用高通Vuforia导出XCode包编译出错
  15. ssh下常用操作汇总(good)
  16. java编程思想笔记(第一章)
  17. 两个input在同一行连着不留缝隙
  18. EF的简单认识
  19. 设置radio选中
  20. 如何使用JavaScript实现纯前端读取和导出excel文件

热门文章

  1. 杂项:ASP.NET Core
  2. vue 基本知识整理
  3. oracle报ORA-00911:invalid character
  4. k8s-容器资源需求、资源限制及HeapSter-二十二
  5. python学习笔记4-时间函数
  6. Tomcat黑窗口改变Title
  7. bzoj 2084: [Poi2010]Antisymmetry【回文自动机】
  8. 二分优化的lis
  9. spring cloud feign 调用接口报错"No message available
  10. AtCoder Regular Contest 081 F - Flip and Rectangles