adding config for arch linux and nginx
This commit is contained in:
@@ -22,19 +22,20 @@ services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
services.AddEndpointsApiExplorer();
|
||||
services.AddSwaggerGen();
|
||||
|
||||
string skey = "Super Secret SIGN AND VERIFY JWT TOKENS";
|
||||
var appSettingsSection = builder.Configuration.GetSection("AppSettings");
|
||||
string skey = "";
|
||||
if (appSettingsSection == null)
|
||||
{
|
||||
skey = builder.Configuration.GetValue<string>("AppSettings:SecretKey");
|
||||
}
|
||||
else
|
||||
if (appSettingsSection != null)
|
||||
{
|
||||
services.Configure<AppSettings>(appSettingsSection);
|
||||
var appSettings = appSettingsSection.Get<AppSettings>();
|
||||
skey = appSettings.Secret;
|
||||
if ( appSettings != null)
|
||||
skey = appSettings.Secret;
|
||||
else
|
||||
{
|
||||
skey = builder.Configuration.GetValue<string>("AppSettings:Secret");
|
||||
}
|
||||
}
|
||||
|
||||
var key = Encoding.ASCII.GetBytes(skey);
|
||||
|
||||
services.AddAuthentication(x =>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
|
||||
"AppSettings": {
|
||||
"Secret": "Nepean Blue Mountain Super Secret SIGN AND VERIFY JWT TOKENS, BEARER TOKEN USE WHEN CALLING THIS API.",
|
||||
"Secret": "Super Secret SIGN AND VERIFY JWT TOKENS, BEARER TOKEN USE WHEN CALLING THIS API.",
|
||||
"SQLConnectionString": "host=localhost;port=5432;database=FamilyTreeDB;username=postgres;password=Positive~1;",
|
||||
"SQLConnectionString_vm": "host=192.168.1.240;port=5432;database=FamilyTreeDB;username=postgres;password=Positive~1;",
|
||||
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
[Unit]
|
||||
Description=ASP.NET Core Web App running on Ubuntu
|
||||
Description=ASP.NET Core Web App running on arch linux
|
||||
[Service]
|
||||
WorkingDirectory=/var/www/familytree/api
|
||||
ExecStart=/usr/bin/dotnet /var/www/familytree/api/FamilyTreeAPI.dll
|
||||
Restart=always
|
||||
# Restart service after 10 seconds if the dotnet service crashes:
|
||||
RestartSec=10
|
||||
# Restart service after 20 seconds if the dotnet service crashes:
|
||||
RestartSec=20
|
||||
KillSignal=SIGINT
|
||||
SyslogIdentifier=dotnet-web-familytree-api
|
||||
# This user should exist on the server and have ownership of the deployment directory
|
||||
User=www-data
|
||||
#User=www-data this is other ubuntu
|
||||
#arch linux has user http
|
||||
User=http
|
||||
Environment=ASPNETCORE_ENVIRONMENT=Production
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
#make sure in nginx.conf has include module.d/*.conf inside http block one.
|
||||
server {
|
||||
listen 80; #make nginx out side listen 82;
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:5000;
|
||||
location /familytreeapi/ {
|
||||
#proxy_pass http://127.0.0.1:5015;
|
||||
proxy_pass http://192.168.1.219:5015/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection keep-alive;
|
||||
@@ -13,20 +14,23 @@
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /familytreeui {
|
||||
return 301 /familytreeui/; #if same one redirect to /familytreeui/
|
||||
}
|
||||
location /familytreeui/ {
|
||||
root /var/www/familytree; #path must exist like /var/www/familytree/familytreeui and /var/www/familytree/api folder.
|
||||
index index.html
|
||||
root /var/www/familytree/; #path must exist like /var/www/familytree/familytreeui and /var/www/familytree/api folder.
|
||||
#index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
|
||||
# Optional: Cache static assets for better performance
|
||||
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
#location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
|
||||
# expires 30d;
|
||||
# add_header Cache-Control "public";
|
||||
#}
|
||||
|
||||
error_page 404 /index.html;
|
||||
# error_page 404 /index.html;
|
||||
|
||||
# put in /etc/nginx/sites-availalble/familytreeapp.conf
|
||||
# link to enable
|
||||
|
||||
Reference in New Issue
Block a user