]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
API+Docker: enable nginx URL rewriting
authorVirtualTam <virtualtam@flibidi.net>
Wed, 4 Jan 2017 17:06:14 +0000 (18:06 +0100)
committerVirtualTam <virtualtam+github@flibidi.net>
Thu, 5 Jan 2017 12:24:00 +0000 (13:24 +0100)
Closes https://github.com/shaarli/Shaarli/issues/668

Changed:
- let nginx rewrite API URLs

See:
- https://www.slimframework.com/docs/start/web-servers.html
- https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_split_path_info

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
docker/development/nginx.conf
docker/production/nginx.conf
docker/production/stable/nginx.conf

index ac0c6c61ce165976b7572bb96eb8ba90b5f4d2a8..79c45bfe9049dad77de492648260cb283a5859c7 100644 (file)
@@ -56,7 +56,16 @@ http {
             alias /var/www/shaarli/images/favicon.ico;
         }
 
+        location / {
+            # Slim - rewrite URLs
+            try_files $uri /index.php$is_args$args;
+        }
+
         location ~ (index)\.php$ {
+            # Slim - split URL path into (script_filename, path_info)
+            try_files $uri =404;
+            fastcgi_split_path_info ^(.+\.php)(/.+)$;
+
             # filter and proxy PHP requests to PHP-FPM
             fastcgi_pass   unix:/var/run/php5-fpm.sock;
             fastcgi_index  index.php;
index 5ffa02d0a9d570136d4ab7ea8f8bef4107f03cb7..e8754d9b478f85cbeb033756d2114759f1809d37 100644 (file)
@@ -48,7 +48,16 @@ http {
             alias /var/www/shaarli/images/favicon.ico;
         }
 
+        location / {
+            # Slim - rewrite URLs
+            try_files $uri /index.php$is_args$args;
+        }
+
         location ~ (index)\.php$ {
+            # Slim - split URL path into (script_filename, path_info)
+            try_files $uri =404;
+            fastcgi_split_path_info ^(.+\.php)(/.+)$;
+
             # filter and proxy PHP requests to PHP-FPM
             fastcgi_pass   unix:/var/run/php5-fpm.sock;
             fastcgi_index  index.php;
index 5ffa02d0a9d570136d4ab7ea8f8bef4107f03cb7..e8754d9b478f85cbeb033756d2114759f1809d37 100644 (file)
@@ -48,7 +48,16 @@ http {
             alias /var/www/shaarli/images/favicon.ico;
         }
 
+        location / {
+            # Slim - rewrite URLs
+            try_files $uri /index.php$is_args$args;
+        }
+
         location ~ (index)\.php$ {
+            # Slim - split URL path into (script_filename, path_info)
+            try_files $uri =404;
+            fastcgi_split_path_info ^(.+\.php)(/.+)$;
+
             # filter and proxy PHP requests to PHP-FPM
             fastcgi_pass   unix:/var/run/php5-fpm.sock;
             fastcgi_index  index.php;