城阳区网站建设公司,什么网站可以做高三英语试题,网站建设的目标和需求,上海官方网站建场景介绍#xff1a;
因为业务需求#xff0c;我们需要对域名进行解析#xff0c;这里我对域名进行了如下解析但是#xff0c;因为业务需求#xff0c;我可能在nginx中只定义了kuman.xiaobudiu.top 和 www.xiaobudiu.top 的相应server的子配置文件#xff0c;如图那么问题…场景介绍
因为业务需求我们需要对域名进行解析这里我对域名进行了如下解析但是因为业务需求我可能在nginx中只定义了kuman.xiaobudiu.top 和 www.xiaobudiu.top 的相应server的子配置文件如图那么问题来了怎么才能让其余已经解析的域名访问时不会出现空白或是报错页面呢
这时我们就需要应用到一个参数default_server让所有已经解析但是在nginx中没有对应server配置的域名默认访问到我们设置的带default_server参数的server。
配置文件示例server {listen 80 default_server;server_name www.xiaobudiu.top;charset utf-8;error_log /etc/nginx/logs/error/www.xiaobudiu.top.log error;access_log /etc/nginx/logs/access/www.xiaobudiu.top.log main;root /data/www;index index.html index.htm index.php;location /favicon.ico {log_not_found off;access_log off;}location ~ \.php$ {fastcgi_pass unix:/dev/shm/php-cgi.sock;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}location ~ /\.ht {deny all;}}这样当我访问www.xiaobudiu.top 和kuman.xiaobudiu.top 时就会访问到对应server设置的路径而访问test.xiaobudiu.top 和 test.up.xiaobudiu.top域名时就会默认访问www.xiaobudiu.top网站