标签:local root pre doc root密码 spn topic system 教程
1
2
3
4
5
6
7
8
9
|
# 1、下载对应当前系统版本的nginx包(package),具体版本根据自己情况http://nginx.org/packages/ wget http: //nginx .org /packages/centos/7/noarch/RPMS/nginx-release-centos-7-0 .el7.ngx.noarch.rpm # 2、建立nginx的yum仓库 rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm # 3、下载并安装nginx yum install nginx # 4、启动nginx服务 systemctl start nginx # 或者 service nginx start命令也可以 |
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main ‘$remote_addr - $remote_user [$time_local] "$request" ‘
‘$status $body_bytes_sent "$http_referer" ‘
‘"$http_user_agent" "$http_x_forwarded_for"‘;
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
#如果是多站点配置,需要启用这个配置,然后在conf.d文件夹下,创建多个配置文件即可。比如www.a.com.conf、www.b.com.conf
#include /etc/nginx/conf.d/*.conf;
server {
listen 80;
#root /usr/share/nginx/html;
#index index.html index.htm;
# Make site accessible from http://localhost/
server_name hwapp.netcore.cn;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
[root@localhost /]# whereis nginx
nginx: /usr/sbin/nginx /etc/nginx /usr/share/nginx /usr/share/man/man3/nginx.3pm.gz /usr/share/man/man8/nginx.8.gz
# 检测配置是否有问题
[root@localhost /]# /usr/sbin/nginx -t
nginx: [emerg] invalid URL prefix in /etc/nginx/nginx.conf:49
nginx: configuration file /etc/nginx/nginx.conf test failed
[root@localhost /]# /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
#重启nginx服务,
[root@localhost /]# sudo service nginx restart
Redirecting to /bin/systemctl restart nginx.service
[root@localhost /]#
#或者使用reload
[root@localhost /]# /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@localhost /]# sudo nginx -s reload
[root@localhost /]#
setsebool -P httpd_can_network_connect 1
[hager@localhost publish]$ dotnet HelloWebApp.dll
Hosting environment: Production
Content root path: /opt/DotNetCorePublish/HelloWebApp/publish
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
[CentOS] 结合Nginx部署DotNetCore的demo项目
标签:local root pre doc root密码 spn topic system 教程
原文地址:http://www.cnblogs.com/wangpd/p/7567695.html