Linux-RedHat7.2 安装nginx托管.net core2.0
2024-08-30 14:44:01
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
最新文章
- erlang 在线生成crashdump
- 【生活没有希望】poj1273网络流大水题
- 使用dedecms中常见错误提示及解决办法(一)
- POJ 1308
- tensor
- 第12条:考虑实现Comparable接口
- python 自动化之路 day 01 人生若只如初见
- 【HDOJ】3560 Graph’s Cycle Component
- JS之路——数组对象
- windows应用中调用DLL一步步试验
- iBatis2之SqlMap配置总结(18条)
- django框架介绍
- Android Studio 打包流程
- UNITY使用高通Vuforia导出XCode包编译出错
- ssh下常用操作汇总(good)
- java编程思想笔记(第一章)
- 两个input在同一行连着不留缝隙
- EF的简单认识
- 设置radio选中
- 如何使用JavaScript实现纯前端读取和导出excel文件
热门文章
- 杂项:ASP.NET Core
- vue 基本知识整理
- oracle报ORA-00911:invalid character
- k8s-容器资源需求、资源限制及HeapSter-二十二
- python学习笔记4-时间函数
- Tomcat黑窗口改变Title
- bzoj 2084: [Poi2010]Antisymmetry【回文自动机】
- 二分优化的lis
- spring cloud feign 调用接口报错";No message available
- AtCoder Regular Contest 081 F - Flip and Rectangles