经过10多个小时的研究,我还没有想出为什么这不起作用!我试图将我的本地主机移动到/ etc/nginx/sites-enabled/default中启用了站点的文件夹中。Nginx没有在启用网站的网站中选取网站?
它是来自sites-available文件夹的符号链接。当采用下面的配置,我碰到一个 “无法连接” 使用本地主机:8080为我的地址
nginx.conf(/usr/local/nginx/conf/nginx.conf):
user www-data;
worker_processes 2;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/sites-enabled/*;
}
网站 - 可选(在/ etc/nginx的/网站可用/默认):
server {
listen 8080;
root /home/myusername/myown/customdirectory;
index index.php index.html index.htm;
server_name localhost;
location/{
try_files $uri $uri/ /index.html;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
我能得到这个工作,如果我把从可用到nginx.conf网站的相关信息,我只是想不通为什么它不以这种方式工作?
谢谢!
你确定符号链接不破? ls -l /etc/nginx/ sites-enabled/ –
是的,我没有仔细检查符号链接,仍然没有运气 – Discorick
另请参阅:http://stackoverflow.com/questions/17413526/nginx-missing-sites-available-directory – 2013-12-18 17:54:09