Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

586
Vistas
Ruta de la regla de reescritura de Nginx a la cadena de consulta

Ejemplos:

ejemplo.com/asd -> ejemplo.com/portal.php?id=asd

ejemplo.com -> ejemplo.com/portal.php

ejemplo.com/asd?document=nuevo -> ejemplo.com/portal.php?id=asd&document=nuevo

Hasta ahora solo funciona: ejemplo.com -> ejemplo.com/portal.php

Esto es lo que tengo hasta ahora:

 server { listen 80; listen [::]:80; root /var/www/html/public_html; server_name example.com; if ($http_x_forwarded_proto = 'http'){ return 301 https://$host$request_uri; } location / { # try to serve file directly, fallback to index.php try_files $uri /portal.php$is_args$args; } # LEGACY # This rule should only be placed on your development environment # In production, don't include this and don't deploy app_dev.php or config.php location ~ ^/(portal)\.php(/|$) { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_pass unix:/run/php/php7.2-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_param HTTPS on; # When you are using symlinks to link the document root to the # current version of your application, you should pass the real # application path instead of the path to the symlink to PHP # FPM. # Otherwise, PHP's OPcache may not properly detect changes to # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 # for more information). fastcgi_param DOCUMENT_ROOT $realpath_root; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; internal; } # return 404 for all other php files not matching the front controller # this prevents access to other php files you don't want to be accessible. location ~ \.php$ { return 404; } error_log /var/log/nginx/project_error.log; access_log /var/log/nginx/project_access.log; }
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Puedes hacerlo así:

 server { listen 80; listen [::]:80; root /var/www/html/public_html; server_name example.com; if ($http_x_forwarded_proto = 'http'){ return 301 https://$host$request_uri; } # landing page location =/ { # try to serve file directly, fallback to index.php try_files $uri /portal.php$is_args$args; } # other pages location / { rewrite ^(.*)$ /portal.php?id=$1 last } # LEGACY # This rule should only be placed on your development environment # In production, don't include this and don't deploy app_dev.php or config.php location ~ ^/(portal)\.php(/|$) { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_pass unix:/run/php/php7.2-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_param HTTPS on; # When you are using symlinks to link the document root to the # current version of your application, you should pass the real # application path instead of the path to the symlink to PHP # FPM. # Otherwise, PHP's OPcache may not properly detect changes to # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 # for more information). fastcgi_param DOCUMENT_ROOT $realpath_root; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; internal; } # return 404 for all other php files not matching the front controller # this prevents access to other php files you don't want to be accessible. location ~ \.php$ { return 404; } error_log /var/log/nginx/project_error.log; access_log /var/log/nginx/project_access.log; }
over 4 years ago · Santiago Trujillo Denunciar

0

De esta manera funciona:

 location / { try_files $uri $uri/ @rules; } location @rules { rewrite ^(.*)$ /portal.php?id=$1 last; }
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda