2

I am asking for how to configure nginx. For now i tried some variations and stack on this:

server {
  listen 80 default_server;
  listen [::]:80 default_server;
  root /srv/appfolder/build;
  index index.html;
  server_name my_server_ip_without_http;
  location / {
    try_files $uri $uri/ =404;
  }
}
~   

Now- when i hitting the server IP i got :

Welcome to nginx!

For now I am trying only http for beginning. Is it possible to make it work in format IP:port/pagename ? or IP:pagename? Is it possible to serve several apps on different ports and enable app page uri work?

Ahmet Emre Kilinc
  • 5,489
  • 12
  • 30
  • 42
Tyler Brin
  • 59
  • 1
  • 4

1 Answers1

0

You will have to work with the react-router, in addition configure your .htaccess to be compatible. Example:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]