rinormaloku / k8s-mastery

Repository for the article "Learn Kubernetes in Under 3 Hours"
https://medium.com/p/114ff420e882/
897 stars 839 forks source link

Create a custom nginx.conf file #35

Open ivan-rivera opened 4 years ago

ivan-rivera commented 4 years ago

First, thank you for this amazing tutorial. When I reached the Nginx installation section, I thought that it wasn't optimal to move the contents of my frontend into the nginx HTML directory and instead I decided to create a custom nginx.conf file in my sa-frontend repo, so that way I can launch the server with nginx -c nginx.conf. Here is what the server definition of my conf file looks like:

  server {
    listen       80;
    server_name  localhost;

    location / {
      root   /path/to/sa-frontend/build;
      index  index.html;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
      root   html;
    }
  }

I think this is a cleaner solution for running the app locally, however, if we run the app on Docker, then we should probably stick with the original approach.

rinormaloku commented 4 years ago

I like this, does it work for Windows?

On Fri, Jul 3, 2020 at 3:43 PM Ivan Rivera notifications@github.com wrote:

First, thank you for this amazing tutorial. When I reached the Nginx installation section, I thought that it wasn't optimal to move the contents of my frontend into the nginx HTML directory and instead I decided to create a custom nginx.conf file in my sa-frontend repo, so that way I can launch the server with nginx -c nginx.conf. Here is what the server definition of my conf file looks like:

server { listen 80; server_name localhost;

location / {
  root   /path/to/sa-frontend/build;
  index  index.html;
}

error_page   500 502 503 504  /50x.html;
location = /50x.html {
  root   html;
}

}

I think this is a cleaner solution so it might be worthwhile updating the documentation with this.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rinormaloku/k8s-mastery/issues/35, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACE3XE5WULB2762U7C5ACSTRZXOBTANCNFSM4OP2K6IQ .

ivan-rivera commented 4 years ago

Does it work on Windows? Good question! I'm not sure, I think it should, but I tested it on a Mac

rinormaloku commented 4 years ago

Mac is using linux underneath, which uses the same structure of storing files, I am not sure how nginx would react with spaces which are rlly frequent in Windows.

I currently do not have a Win computer, but if it could be tested there it'd be great and I could update the article

Best Rinor ✌️

On Fri, Jul 3, 2020 at 3:50 PM Ivan Rivera notifications@github.com wrote:

Does it work on Windows? Good question! I'm not sure, I think it should, but I tested it on a Mac

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rinormaloku/k8s-mastery/issues/35#issuecomment-653557838, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACE3XE2DNY5D3Z2EQE4T6U3RZXOYTANCNFSM4OP2K6IQ .