Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

580
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda