Project

General

Profile

REST API NGINX

Added by Yakov Myagkov almost 4 years ago

Hello friends, there is an installation of redmine + nginx, the nginx configuration is sharpened for https (the nginx config is below):

passenger_root /usr/share/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /opt/redmine/.rvm/gems/default/wrappers/ruby;
passenger_instance_registry_dir /var/run/passenger-instreg;

server {
listen 443 ssl;

server_name myredmine.com;
root /opt/redmine/redmine-4.0.4/public;
#return 301 https://$server_name$request_uri;
#Include phpmyadin
include /etc/nginx/snippets/phpMyAdmin.conf;
  1. log files
    access_log /var/log/nginx/example.com.access.log;
    error_log /var/log/nginx/example.com.error.log;
passenger_enabled on;
passenger_min_instances 1;
client_max_body_size 10m;
ssl_certificate /etc/ssl/certs/nginx-selfsigned1.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned1.key;
}

The problem is that I need access to the api, but as stated in the documentation, authorization to the rest api occurs over http, even when I try to open the issue via the api-I see the message: < html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.17.3</center>
</body>
</html> . Naturally, nothing comes out. What changes should I make to the nginx configuration so that it continues to work on https, but access to the api is over http? How to make a redirect correctly?