Примеры:
example.com / asd -> example.com/portal.php?id=asd
example.com - > example.com/portal.php
example.com / asd? document = new -> example.com/portal.php?id=asd&document=new
Пока работает только: example.com -> example.com/portal.php
Это то, что у меня так далеко:
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;
}