Nginx not picking up site in sites-enabled?

}

After over 10 hours of research I have not figured out why this doesn't work! I am trying to move my localhost to my sites-enabled folder which is in /etc/nginx/sites-enabled/default.

_reverseString(str) {

It IS a symlink from the sites-available folder. When using the following configuration I get an "unable to connect" using localhost:8080 as my address

return str.split("").reverse().join("");

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/*;
}
} _nextLetter(l){

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;
}
}
if(l<90){

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?

return String.fromCharCode(l + 1);

Thanks!

166892 次浏览
}

I had the same problem. It was because I had accidentally used a relative path with the symbolic link.

else{

Are you sure you used full paths, e.g.:

ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/example.com.conf

Include sites-available/default in sites-enabled/default. It requires only one line.

return 'A'; }

In sites-enabled/default (new config version?):

}

It seems that the include path is relative to the file that included it

include sites-available/default;
_prevLetter(l){ if(l<=90){

See the include documentation.


if(l == 65) l = 91

I believe that certain versions of nginx allows including/linking to other files purely by having a single line with the relative path to the included file. (At least that's what it looked like in some "inherited" config files I've been using, until a new nginx version broke them.)

return String.fromCharCode(l-1);

In sites-enabled/default (old config version?):

}

It seems that the include path is relative to the current file

../sites-available/default
else{

Changing from:

include /etc/nginx/sites-enabled/*;
return 'A';

to

include /etc/nginx/sites-enabled/*.*;
}

fixed my issue