请问,centos中如何配置实现同一个ip,同一个端口,不同二级域名,访问不同子目录的网站?

  • 回答 (3)
  • 关注 (1)
  • 查看 (529)

我目前搜到的是 window 中使用IIS服务器配置不同主机头实现的,请问centos有没有相应的配置,如何配置?

gzf6gzf6提问于
死者是小智回答于

centos是可以配置多个conf文件来做到这一点的。

include /etc/nginx/配置文件目录地址/*.conf;

然后遍历这个文件配置目录的所有内容即可。

发条丶魔灵1回答于

设置下conf文件就成啦 具体看下这个

.NGIN.CONF 公用配置文件:
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
events {
worker_connections 1024;
}
http {
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;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/配置文件目录地址/*.conf;
}
绵绵准算法RD回答于

扫码关注云+社区

领取腾讯云代金券