我已经设置了具有多个服务器块的NGINX服务器。我已将2个简单的网站配置为在同一服务器上运行。它们指向在相应的服务器块文件中指定的两个不同的根路径。
我已经更新了两个域的DNS详细信息:
名称服务器:根据注册商的详细信息
A记录:更新了相同的静态IP地址
但是,当我在浏览器中对domain2.com进行测试时,它将重定向到domain1.com。我究竟做错了什么?我已经使用以下命令重新启动了Nginx服务器:
data3['Close2'] = data3['Close'].copy()
data3['Close2']=data3['Close'].values
data3['Close_input'] = data3['Close'].copy(deep=True)
data3['Close_input'] = data3.loc[:, ('Close')]
data3.Close_input = data3.Close
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
这是我的服务器块的样子:
sudo systemctl restart nginx
这是我的第二个服务器阻止文件:
# Default server configuration
#
server {
root /var/www/domain1.com/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name domain1.com www.domain1.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain1.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain1.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.domain1.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = domain1.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name domain1.com www.domain1.com;
return 404; # managed by Certbot
}
答案 0 :(得分:2)
您的服务器块配置文件非常完美。请勿更改任何内容。让我解释发生了什么。您的服务器块指示您已安装certbot,可能是为了为domain1.com部署Lets Encrypt SSL证书,而domain2.com的服务器块尚没有certbot管理的任何条目。这可能意味着您正在对domain1.com使用ssl证书,而不对domain2.com使用ssl证书。
在为domain1.com配置SSL证书时,您可能选择了将所有流量重定向到SSL的选项。发生的情况是,当dns服务器向您的Web服务器发送对domain2.com的请求时,它期望该域的SSL证书但找不到。然后,它将所有流量重定向到已安装有效SSL证书的现有域。
但是,证书(domain1.com)上的域名应与DNS服务器为domain2.com传递的信息不匹配。因此,它极有可能引发有关无效SSL证书的错误或警告消息。
解决方案:就像为domain1.com一样为domain2.com安装新的SSL证书,并且一切正常。
让我知道它是否有效。