Eu tenho um proxy reverso nginx rodando no Ubuntu 14.04 LTS. Quando são feitas solicitações ao proxy nginx, ele é passado para um servidor IIS contendo um site (padrão). Parece renderizar o HTML bem, mas infelizmente o servidor responde com um erro 404 para todos os outros recursos.
Aqui está o arquivo /etc/nginx/nginx.conf
:
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile off;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Aqui está minha configuração do servidor default
nginx:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
index index.php index.html index.htm;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ =404;
proxy_pass http://104.46.52.226/;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Veja o resultado da solicitação para example.com
ou www.example.com
(o arquivo de hosts foi alterado):
Euimagineiquetalvezfosseumproblemacomofatodenãohaverumadiretivaroot
naconfiguraçãodomeuservidor-maseurealmentenãosabiaporondecomeçaresseproblema.NomínimoeuseiquenãoéumproblemacomopróprioservidorIIS,porqueeupossoprocurarolocalhostperfeitamente.
Algumaideia?Muitoobrigadoantecipadamente.
Editar:aquiestãoosmeusregistrosdeerrotambém:
2015/10/1309:41:10[emerg]3069#0:invalidnumberofargumentsin"proxy_pass" directive in /etc/nginx/sites-enabled/armari.com:31
2015/10/13 10:12:33 [emerg] 3606#0: "listen" directive is not allowed here in /etc/nginx/sites-enabled/armari.com:2
2015/10/13 13:39:18 [error] 3911#0: *1 open() "/usr/share/nginx/html/css/new-web.css" failed (2: No such file or directory), client: 188.39.188.214, server: armari.com, request: "GET /css/new-web.css HTTP/1.1", host: "www.armari.com", referrer: "http://www.armari.com/"
2015/10/13 13:39:18 [error] 3911#0: *3 open() "/usr/share/nginx/html/css/nivo/themes/default/default.css" failed (2: No such file or directory), client: 188.39.188.214, server: armari.com, request: "GET /css/nivo/themes/default/default.css HTTP/1.1", host: "www.armari.com", referrer: "http://www.armari.com/"
2015/10/13 13:39:18 [error] 3911#0: *4 open() "/usr/share/nginx/html/css/nivo/nivo-slider.css" failed (2: No such file or directory), client: 188.39.188.214, server: armari.com, request: "GET /css/nivo/nivo-slider.css HTTP/1.1", host: "www.armari.com", referrer: "http://www.armari.com/"
2015/10/13 13:39:21 [error] 3911#0: *8 open() "/usr/share/nginx/html/css/new-web.css" failed (2: No such file or directory), client: 188.39.188.214, server: armari.com, request: "GET /css/new-web.css HTTP/1.1", host: "armari.com", referrer: "http://armari.com/"
2015/10/13 13:39:21 [error] 3909#0: *10 open() "/usr/share/nginx/html/css/nivo/themes/default/default.css" failed (2: No such file or directory), client: 188.39.188.214, server: armari.com, request: "GET /css/nivo/themes/default/default.css HTTP/1.1", host: "armari.com", referrer: "http://armari.com/"
2015/10/13 13:39:21 [error] 3909#0: *11 open() "/usr/share/nginx/html/css/nivo/nivo-slider.css" failed (2: No such file or directory), client: 188.39.188.214, server: armari.com, request: "GET /css/nivo/nivo-slider.css HTTP/1.1", host: "armari.com", referrer: "http://armari.com/"