Configure nginx with multiple locations with different root folders on subdomain

You need to use the alias directive for location /static: server { index index.html; server_name test.example.com; root /web/test.example.com/www; location /static/ { alias /web/test.example.com/static/; } } The nginx wiki explains the difference between root and alias better than I can: Note that it may look similar to the root directive at first sight, but the document … Read more

react app showing empty page when redirecting on production build

Downgrade your “history” version or simply remove it because the correct version will be automatically added by “react-router-dom”. There is already an open issue about the same: https://github.com/ReactTraining/history/issues/804 Which says React Router (mainly history.push and Redirect) is not working properly with latest (v5) version of history. But it is working perfectly with v4 of history. … Read more

Nginx: Serve multiple Laravel apps with same url but two different sub locations in Linux

During one of the deployment on linux server, I came across some sort of your challenge. It was as follow <base_url> : One Laravel project needs to served on this. <base_url>/<sub_url> : Another Laravel project needs to be served on this. Of course this can be extended to any number of Laravel projects which follows … Read more

How to serve GIT through HTTP via NGINX with user/password?

Take a look at the following article, http://www.toofishes.net/blog/git-smart-http-transport-nginx/ It provides a sample nginx config: http { … server { listen 80; server_name git.mydomain.com; location ~ /git(/.*) { # fcgiwrap is set up to listen on this host:port fastcgi_pass localhost:9001; include fastcgi_params; fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend; # export all repositories under GIT_PROJECT_ROOT fastcgi_param GIT_HTTP_EXPORT_ALL “”; fastcgi_param GIT_PROJECT_ROOT … Read more

tech