添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

检查 /etc/nginx/nginx.conf (nginx 默认配置文件路径,如果使用其他方式部署,对应部署的其他路径)配置文件,确保文件中包含 include /etc/nginx/conf.d/ .conf;

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
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.d/*.conf;  #nginx 站点配置文件路径
    server {
        listen       80 default_server; #默认监听端口
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html; #默认站点路径
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;
        location / {
        error_page 404 /404.html;
        location = /404.html {
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {

在目录 /etc/nginx/conf.d 下面新建 website1.conf,website2.conf,文件名可自定义。监听端口都改为 80 端口并绑定不同的域名,root 路径分别配置为不同的站点路径。

website1.conf 文件内容:

server {
    listen       80;	#website1 监听端口
    server_name  one.example.com;	#website1 绑定域名
    root         /var/www/html/web1/;	#website1 站点路径
    # Load configuration files for the default server block.
    location / {
        index index.php index.html index.htm;	#站点默认页面
    error_page 404 /404.html;
        location = /40x.html {
    error_page 500 502 503 504 /50x.html;
        location = /50x.html {

website2.conf 文件内容:

server {
    listen       80;	# website2 监听端口
    server_name  two.example.com;	# website2 绑定域名
    root         /var/www/html/web2/;	# website2 站点路径
    # Load configuration files for the default server block.
    location / {
        index index.php index.html index.htm;	# 站点默认页面
    error_page 404 /404.html;
        location = /40x.html {
    error_page 500 502 503 504 /50x.html;
        location = /50x.html {