Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Dunkstormen Posted April 22, 2020 Posted April 22, 2020 Anyone having some experience with NGINX and can help me setting up my API location, so I can pass the API Token using headers rather than as a part of the URL? Have been looking on sites like Stackoverflow for a potential solution, yet none of the suggestions has worked. The exact message I get is the one on the attached image. upstream php_backend { server unix:/var/run/php-fpm_webapp.sock; } server { # Basic server configuration listen 443 ssl; server_name XXXXXXXXXX XXXXXXXXXX; include snippets/self-signed.conf; include snippets/ssl-params.conf; include snippets/real_ip_cf.conf; root XXXXXXXXXX; index index.php; # Maximum allowed upload size client_max_body_size 100M; # Logging access_log XXXXXXXXXX/access.log main; error_log XXXXXXXXXX/error.log error; # Friendly URL "rewrite" rules location / { try_files $uri $uri/ @ips; } # Configuration includes include /etc/nginx/includes/ips/protect_upload_directories; include /etc/nginx/includes/deny_dotfiles; include /etc/nginx/includes/stub_status; include /etc/nginx/includes/php_fpm_status; # Assign cache headers to static files location ~* ^.+\.(?:jpg|jpeg|gif|css|png|js|ico|xml|htm|swf|cur)$ { # If the static resource doesn't exist, pass off to IPS' 404 handler try_files $uri @ips404; access_log off; expires 2w; } # Lock down access to the AdminCP location ~ ^/admin/.+\.php$ { #allow 127.0.0.1; #deny all; #auth_basic "This page is restricted to administrators"; #auth_basic_user_file $document_root/admin/.htpasswd; try_files $uri @ips404; include /etc/nginx/includes/php_fastcgi_params; fastcgi_pass php_backend; } # Execute the requested PHP script if it exists, otherwise pass off to IPS location ~ \.php$ { try_files $uri @ips; include /etc/nginx/includes/php_fastcgi_params; fastcgi_pass php_backend; fastcgi_buffers 38 4k; fastcgi_buffer_size 16k; } # Pass off not found errors to IPS' 404 handler location @ips404 { include /etc/nginx/includes/php_fastcgi_params; fastcgi_pass php_backend; fastcgi_param SCRIPT_FILENAME $document_root/404error.php; fastcgi_param SCRIPT_NAME 404error.php; } # Send rewritten requests directly to IPS location @ips { include /etc/nginx/includes/php_fastcgi_params; fastcgi_pass php_backend; fastcgi_param SCRIPT_FILENAME $document_root/index.php; fastcgi_param SCRIPT_NAME /index.php; fastcgi_buffers 38 4k; fastcgi_buffer_size 16k; } # IPS API location /api/ { try_files $uri $uri/ @api; } # IPS API LOCATION location @api { rewrite ^ /api/index.php?$args last; } } server { listen 80; server_name XXXXXXXXXX XXXXXXXXXXX; return 302 https://$server_name$request_uri; } Some information has been replaced with "XXXXXXXXXX" due privacy/security.
Recommended Posts