• Jobs
  • About Us
  • Jobs
    • Home
    • Jobs
    • Courses and challenges
  • Businesses
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

1.3K
Views
Nginx 403 Prohibido para ubicación y localhost

Mi objetivo es acceder a una ubicación específica (es decir, phpmyadmin) usando un túnel SSH http://localhost/phpmyadmin

Acabo de instalar Ubuntu 20.04 con Nginx. La siguiente configuración funcionaba bien con Ubuntu 18.04.

Edité /etc/nginx/sites-available/default agregando:

 location /phpmyadmin { #Allow localhost allow 127.0.0.1; #deny all the others ip deny all; }

cuando accedo a http://localhost/phpmyadmin recibo el mensaje de error:

403 Prohibido nginx/1.17.10 (Ubuntu)

Solo para probar, eliminé "negar todo"; todo funciona bien, pero cada dirección IP puede acceder a la ubicación phpmyadmin.

registro de errores nginx:

2020/05/05 23:52:13 [error] 21905#21905: *1 acceso prohibido por regla, cliente: ::1, servidor: _, solicitud: "GET /phpmyadmin/ HTTP/1.1", host: "localhost "

 server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html index.php; server_name _; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } # pass PHP scripts to FastCGI server # location ~ \.php$ { include snippets/fastcgi-php.conf; # With php-fpm (or other unix sockets): fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # With php-cgi (or other tcp sockets): #fastcgi_pass 127.0.0.1:9000; } location /phpmyadmin { satisfy all; allow 127.0.0.1; deny all; } }

¿Alguna idea de por qué esta configuración ya no funciona con ubuntu 20.04 y nginx 1.17.10?

over 3 years ago · Santiago Trujillo
1 answers
Answer question

0

También debe permitir :: 1 ... Y agregar los parámetros para el php dentro del bloque de ubicación también.

Prueba así

 server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html index.php; server_name _; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } # pass PHP scripts to FastCGI server # location ~ \.php$ { include snippets/fastcgi-php.conf; # With php-fpm (or other unix sockets): fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # With php-cgi (or other tcp sockets): #fastcgi_pass 127.0.0.1:9000; } location ^~ /phpmyadmin/ { allow 127.0.0.1; allow ::1; deny all; include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; } }
over 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Show me some job opportunities
There's an error!