Nginx沒有在網站啓用中獲取網站? - Nginx not picking up site in sites-enabled?

問題:

After over 10 hours of research I have not figured out why this doesn't work! 經過10多個小時的研究,我還沒弄清楚爲什麼這不起作用! I am trying to move my localhost to my sites-enabled folder which is in /etc/nginx/sites-enabled/default. 我正在嘗試將我的localhost移動到我的啓用站點的文件夾,該文件夾位於/ etc / nginx / sites-enabled / default中。

It IS a symlink from the sites-available folder. 它是來自sites-available文件夾的符號鏈接。 When using the following configuration I get an "unable to connect" using localhost:8080 as my address 使用以下配置時,我使用localhost:8080作爲我的地址“無法連接”

nginx.conf (/usr/local/nginx/conf/nginx.conf): 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/*; 
}

sites-available (/etc/nginx/sites-available/default): sites-available(/ etc / nginx / sites-available / default):

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;
    }
}

I can get this working if I put the relevant info from sites available to the nginx.conf, I just can't figure out why it doesn't work this way? 如果我將相關信息從nginx.conf的可用站點中提取出來,我可以得到這個工作,我只是想不通爲什麼它不能這樣工作?

Thanks! 謝謝!


解決方案:

參考: https://stackoom.com/en/question/rLyh
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章