diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..09988bc --- /dev/null +++ b/nginx.conf @@ -0,0 +1,62 @@ +# auto detects a good number of processes to run +worker_processes auto; + +#Provides the configuration file context in which the directives that affect connection processing are specified. +events { + # Sets the maximum number of simultaneous connections that can be opened by a worker process. + worker_connections 8000; + # Tells the worker to accept multiple connections at a time + multi_accept on; +} + + +http { + # what times to include + include /etc/nginx/mime.types; + # what is the default one + default_type application/octet-stream; + + # Sets the path, format, and configuration for a buffered log write + log_format compression '$remote_addr - $remote_user [$time_local] ' + '"$request" $status $upstream_addr ' + '"$http_referer" "$http_user_agent"'; + + server { + # listen on port 80 + listen 80; + # save logs here + access_log /var/log/nginx/access.log compression; + + # where the root here + root /var/www; + # what file to server as index + index index.html index.htm; + error_page 404 index.html; + + # Media: images, icons, video, audio, HTC + location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { + expires 1M; + access_log off; + add_header Cache-Control "public"; + } + + # Javascript and CSS files + location ~* \.(?:css|js|woff2)$ { + try_files $uri =404; + expires 1y; + access_log off; + add_header Cache-Control "public"; + } + + location / { + # First attempt to serve request as file, then + # as directory, then fall back to redirecting to index.html + try_files $uri $uri/ /index.html; + } + + # Any route containing a file extension (e.g. /devicesfile.js) + location ~ ^.+\..+$ { + try_files $uri =404; + } + } +} \ No newline at end of file diff --git a/src/utils/extractVersionCodeFromHostname.ts b/src/utils/extractVersionCodeFromHostname.ts index c748b40..98062e6 100644 --- a/src/utils/extractVersionCodeFromHostname.ts +++ b/src/utils/extractVersionCodeFromHostname.ts @@ -1,7 +1,7 @@ import { DEFAULT_LANGUAGE } from '@config/app'; const extractVersionCodeFromHostname = (hostname = '') => { - return hostname.substring(0, hostname.lastIndexOf('.')) || DEFAULT_LANGUAGE; + return hostname.substring(0, hostname.indexOf('.')) || DEFAULT_LANGUAGE; }; export default extractVersionCodeFromHostname; diff --git a/tsconfig.2.json b/tsconfig.2.json new file mode 100644 index 0000000..eb9d295 --- /dev/null +++ b/tsconfig.2.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/*": ["src/*"], + "@common/*": ["src/common/*"], + "@config/*": ["src/config/*"], + "@features/*": ["src/features/*"], + "@libs/*": ["src/libs/*"], + "@theme/*": ["src/theme/*"], + "@utils/*": ["src/utils/*"] + }, + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react" + }, + "exclude": ["node_modules"], + "include": ["src"] +} diff --git a/tsconfig.json b/tsconfig.json index eb9d295..615146b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,31 +1,3 @@ { - "compilerOptions": { - "baseUrl": ".", - "paths": { - "@/*": ["src/*"], - "@common/*": ["src/common/*"], - "@config/*": ["src/config/*"], - "@features/*": ["src/features/*"], - "@libs/*": ["src/libs/*"], - "@theme/*": ["src/theme/*"], - "@utils/*": ["src/utils/*"] - }, - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react" - }, - "exclude": ["node_modules"], - "include": ["src"] + "extends": "./tsconfig.2.json" }