我正在尝试在 Ubuntu 13.04 上使用 nginx 设置子域。我之前实际上能够做到这一点:
server {
root /home/ajcrites/projects/site-a/public/;
server_name sub.localhost;
location / {
try_files $uri /index.php;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
然后http://sub.localhost
将完美地工作。
现在,我复制了相同的配置,只是更改了root
(更改为存在的路径)和server_name
其他一些值,例如subber.localhost
. 无论我做什么,我都无法subber.localhost
上班。此外,无论我做什么,在 nginx 运行时我都sub.localhost
无法停止工作。奇怪的是,nginx实际上会抱怨配置文件中的错误,但即使没有也无所谓。 只会 sub.localhost
工作。
我尝试过使用各种组合重复执行以下所有操作:
- 在
sites-available
. nginx 似乎就在那里,因为当我尝试重新加载时它会抱怨错误。 service nginx stop && service nginx start
nginx stop; nginx
nginx -s reload
当我stop
这样做时,pgrep
没有显示任何nginx
进程,所以它似乎正确地停止了。这似乎不是缓存问题,因为新浏览器实例的反应方式相同。