大网数据广告活动
服务器运维问答

Nginx subdomain configuration not being picked up/working

· 52CE 我爱测

I'm trying to setup a server block for a subdomain, but nginx doesn't seem to pick up the configuration (properly). What it does is just pickup the first configuration block available and set it as the appropriate configuration. …

问题原文

原帖链接 · Handige Harrie · CC BY-SA 3.0

I'm trying to setup a server block for a subdomain, but nginx doesn't seem to pick up the configuration (properly). What it does is just pickup the first configuration block available and set it as the appropriate configuration.

My DNS records are as following: https://i.sstatic.net/vFGGq.jpg

My virtual host block looks like this:

server {
  listen 80;
  server_name stage.remykooistra.nl www.stage.remykooistra.nl;

  root /var/www/stage.remykooistra.nl;
  index index.html index.php;

  location / {
    try_files $uri $uri/ /index.php?$args;
  }

  location ~ /(cronjobs|config|lib|app/code){
    deny all;
    return 404;
  }

  location ~ \.php$ {
    include   /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }
}

This is basically the same setup I use for almost all my server blocks, with a few exceptions such as SSL and other denied folder etc..

I hope someone could point out what I'm doing wrong here because I'm really confused on why it just doesn't pick up the right configuration.

已采纳解答

原帖链接 · JayMcTee · CC BY-SA 3.0

Bar some small DNS issues: http://dnscheck.pingdom.com/?domain=stage.remykooistra.nl everything seems OK so I wonder whether your Nginx conf has actually loaded. Check your filenames and restart Nginx.

Also, for www.stage. to work, you need another DNS record.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-01-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。