Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
xDEADC0DE Posted August 1, 2018 Posted August 1, 2018 Hello guys, im running invision on nginx and want to access the REST api. Since i cant use .htaccess files i need to edit the nginx server config. I tried different approaches setting up the rewrite rules but it always gives me this error: The API endpoint is not giving the expected response. Check you followed the instructions correctly. The URL being tested is: https://xxxxx.com/api/core/hello Board settings: Enable Friendly URLs? - Active Rewrite URLs? - Active Force Friendly URLs? - Active nginx server cfg: server { listen 80; listen [::]:80; client_max_body_size 20M; root /var/www/html; index index.php index.html index.htm index.nginx-debian.html; server_name xxxxx.com *.xxxxx.com; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. #try_files $uri $uri/ =404; try_files $uri $uri/ /index.php; } location /api/ { rewrite ^/api/(.*)$ /api/index.php; } #matches any path that starts with /forums #it tries to match the url to a file, then to a directory #and finally to the forum index file in /forums/index.php #location /forums { # try_files $uri $uri/ /forums/index.php; #}? # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { include snippets/fastcgi-php.conf; # With php7.0-cgi alone: # fastcgi_pass 127.0.0.1:9000; # With php7.0-fpm: fastcgi_pass unix:/run/php/php7.0-fpm.sock; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } } Support told me to contact the community so: Can somebody help me? Id really appreciate it! Thanks in advance!
rhyker2u Posted August 1, 2018 Posted August 1, 2018 Been a while I worked with nginx, but aren't you supposed to setup a config for ssl / 443 too? next to port 80. If you happen to have the .htaccess? Then try http://www.anilcetin.com/convert-apache-htaccess-to-nginx/ ... doesn't give the cleanest code, but can be used to writing better rules. And what does your nginx error log files say?
xDEADC0DE Posted August 2, 2018 Author Posted August 2, 2018 thank you very much, i switched from nginx to apache2.
IPv6Freely Posted August 5, 2018 Posted August 5, 2018 Here's what I used successfully: location /forums/api/ { if (!-e $request_filename){ rewrite ^/forums/api/(.*)$ /forums/api/index.php; } }
Steph40 Posted August 5, 2018 Posted August 5, 2018 29 minutes ago, IPv6Freely said: Here's what I used successfully: location /forums/api/ { if (!-e $request_filename){ rewrite ^/forums/api/(.*)$ /forums/api/index.php; } } FYI https://www.nginx.com/resources/wiki/start/topics/depth/ifisevil/
IPv6Freely Posted August 8, 2018 Posted August 8, 2018 On 8/5/2018 at 12:33 PM, Steph40 said: FYI https://www.nginx.com/resources/wiki/start/topics/depth/ifisevil/ cool, thanks!
milan122 Posted October 3, 2018 Posted October 3, 2018 well i use apache and i have the same problem ?`
Mark H Posted October 3, 2018 Posted October 3, 2018 If you use Apache rather than nginx, make sure mod_rewrite is installed and active. If it is and still won't work, please open a ticket to support so we can take a look at your install.
milan122 Posted October 3, 2018 Posted October 3, 2018 48 minutes ago, Mark H said: If you use Apache rather than nginx, make sure mod_rewrite is installed and active. If it is and still won't work, please open a ticket to support so we can take a look at your install. well i use apache2 and mod rewrite ist active but it dont work.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.