Estoy luchando durante dos días con mi configuración de nginx. Leí mucho pero no pude encontrar la pregunta correcta.
Obtuve esto del registro de errores:
30/08/2018 09:36:29 [error] 1525#1525: *12 FastCGI enviado en stderr: "Script principal desconocido" al leer el encabezado de respuesta desde el nivel ascendente, cliente: 127.0.0.1, servidor: admin.local, solicitud: "GET / HTTP/1.1", ascendente: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "admin.local"
La cuestión es que ayer pude cargar admin.local en mi navegador. El único error fue que me salió "Archivo no encontrado". si hice clic en un enlace. (No se pudo profundizar más que /admin.local/) Ahora aparece "Archivo no encontrado" en la página de inicio. No he cambiado nada.
mi sistema: Linux Mint 18 PHP 7.2.9-1+ubuntu16.04.1+deb.sury.org+1 versión de nginx: nginx/1.14.0
ubicación de mi index.php:
lrwxrwxrwx 1 www-data www-data 40 Aug 29 13:49 admin -> /home/me/projekte/admin/public/
Mi directorio nginx x se ve así:
.
├── conf.d
│ └── default.conf
├── fastcgi_params
├── koi-utf
├── koi-win
├── mime.types
├── modules -> /usr/lib/nginx/modules
├── nginx.conf
├── scgi_params
├── sites-available
│ └── admin.conf
├── sites-enabled
│ └── admin.conf -> ../sites-available/admin.conf
├── snippets
│ └── fastcgi-php.conf
├── uwsgi_params
└── win-utf
nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*.conf;
}
admin.conf (/sitios habilitados)
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html/admin;
index index.php index.html index.htm index.nginx-debian.html;
server_name admin.local;
location / {
try_files $uri $uri/ /index.php$is_args$args;#=404;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_read_timeout 864000;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param SERVER_NAME $host;
fastcgi_param PHP_IDE_CONFIG serverName=$server_name;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
etc/anfitriones
127.0.0.1 admin.local
fastcgi_params
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fa
stcgi_param REDIRECT_STATUS 200;
Respuesta1
Actualicé mi admin.conf a:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /website/admin/public;
index index.php;
server_name admin.local;
location / {
try_files $uri $uri/ /index.php$is_args$args;#=404;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
try_files $uri =404;
fastcgi_read_timeout 864000;
# fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_param SERVER_NAME $host;
# fastcgi_param PHP_IDE_CONFIG serverName=$server_name;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
esto resolvió mi problema.