System Information
- Strapi Version: 3.3.3
- Operating System: Ubuntu 18 LTS
- Database: SQLite
- Node Version: 12.19.1
- NPM Version: 6.14.8
- Yarn Version:
Hi there, Strapi companions!
I have a Ubuntu install that uses Nginx as reverse proxy and Tomcat as a page/app server.
I followed this instructions
but I didn’t managed to achieve successs. I can’t access /dashboard nor /api, when I try it I get a Tomcat 404 message error.
Here’s my nginx.conf:
user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
error_log /etc/nginx/logs/error.logevents {
worker_connections 1024;
}http {
include /etc/nginx/conf-enabled/.conf;
include /etc/nginx/sites-enabled/.conf;# Tomcat Server upstream rootwebapp { server botboutique.com.br:8080; } # Strapi server upstream strapi { server botboutique.com.br:1337; }
}
Here is my strapi.conf at /sites-available:
server {
# Listen HTTP
listen 80;
server_name botboutique.com.br;
# Redirect HTTP to HTTPS
return 301 https://$host$request_uri;
}server {
# Listen HTTP
listen 443 ssl
server_name botboutique.com.br;# SSL config ssl_certificate /etc/letsencrypt/live/botboutique.com.br/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/botboutique.com.br/privkey.pem; # Strapi API location /api/ { rewrite ^/api/(.*)$ /$1 break; proxy_pass http://strapi; proxy_http_version 1.1; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_pass_request_headers on; } # Strapi Dashboard location /dashboard { proxy_pass http://strapi/dashboard; proxy_http_version 1.1; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_pass_request_headers on; }
}
And finally my server.js:
> module.exports = ({ env }) => ({ > host: env('HOST', '0.0.0.0'), > port: env.int('PORT', 1337), > url: 'mydomain/api', > admin: { > url: 'mydomain/dashboard', > auth: { > secret: env('ADMIN_JWT_SECRET', 'd1e7989csbd78ff2b56e846e8ue7yt8efd21a0'), > }, > }, > });
===============================================
As I have in nginx.conf an upstream for the Tomcat root, I taked off the #Static Root directive in strapi.conf.
Any clue why it’s not working?
Thank you very much!
LuizC