# setup certificate properties including the commonName (DNSName) property for Chrome 58+
$certificate = New-SelfSignedCertificate `
-Subject pixrpa `
-DnsName VPS-2002 `
-KeyAlgorithm RSA `
-KeyLength 2048 `
-NotBefore (Get-Date) `
-NotAfter (Get-Date).AddYears(2) `
-CertStoreLocation "cert:CurrentUser\My" `
-FriendlyName "pixrpa" `
-HashAlgorithm SHA256 `
-KeyUsage DigitalSignature, KeyEncipherment, DataEncipherment `
-TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.1")
$certificatePath = 'Cert:\CurrentUser\My\' + ($certificate.ThumbPrint)
# create temporary certificate path
$tmpPath = "C:\tmp"
If(!(test-path $tmpPath))
{
New-Item -ItemType Directory -Force -Path $tmpPath
}
# set certificate password here
$pfxPassword = ConvertTo-SecureString -String "11111" -Force -AsPlainText
$pfxFilePath = "c:\tmp\pixpra.pfx"
$cerFilePath = "c:\tmp\pixpra.cer"
# create pfx certificate
Export-PfxCertificate -Cert $certificatePath -FilePath $pfxFilePath -Password $pfxPassword
Export-Certificate -Cert $certificatePath -FilePath $cerFilePath
# import the pfx certificate
Import-PfxCertificate -FilePath $pfxFilePath Cert:\LocalMachine\My -Password $pfxPassword -Exportable
# trust the certificate by importing the pfx certificate into your trusted root
Import-Certificate -FilePath $cerFilePath -CertStoreLocation Cert:\CurrentUser\Root
sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y dotnet-sdk-6
sudo apt-get install apache2
cd /etc/apache2
mkdir ssl
cd ssl
sudo openssl req -new -x509 -days 1461 -nodes -out cert.pem -keyout cert.key -subj "/C=RU/ST=Msk/L=Msk/O=YourCompany/OU=IT Department/CN=master.yourcompany.local/CN=master"
sudo a2enmod proxy_http proxy_html proxy_wstunnel ssl
sudo a2enmod rewrite
sudo systemctl restart apache2
sudo nano /etc/apache2/conf-enabled/netcore.conf
<VirtualHost *:443>
ServerName www.CurrentDomain.com
DocumentRoot /var/netcore
SSLEngine on
SSLCertificateFile ssl/cert.pem
SSLCertificateKeyFile ssl/cert.key
#SSLCertificateChainFile ssl/cert.ca-bundle
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule /(.*) ws://127.0.0.1:5000/$1 [P]
ErrorLog /var/log/apache2/netcore-error.log
CustomLog /var/log/apache2/netcore-access.log common
</VirtualHost>
sudo apachectl configtest
sudo service apache2 restart
sudo service apache2 status
sudo apt update
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
sudo docker pull postgres
sudo docker run -d --restart unless-stopped --name pix-postgres -e POSTGRES_PASSWORD=123456789 -d -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgres
{
"Provider": "PostgreSQL",
"CryptographyKeysFolder": "Keys",
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=master_test;Trusted_Connection=True;MultipleActiveResultSets=true;Persist Security Info=False;",
"PostgreSqlConnection": "User ID=postgres;Password=123456789;Host=localhost;Port=5432;Database=master_test;Pooling=true;"
},
"Logging": {
"LogLevel": {
"Default": "Warning",
"Hangfire": "Information"
}
},
"AllowedHosts": "*",
"PasswordValidationOptions": {
"RequiredLength": "8",
"RequireNonAlphanumeric": "true",
"RequireLowercase": "true",
"RequireUppercase": "true",
"RequireDigit": "true"
},
"UseSwagger": "false"
}
sudo chmod 777 ./{nombre de la carpeta de claves}
#Al especificar un nombre de carpeta, no se coloca "{}".
sudo cp -a <folder> <target folder>
sudo cp -a /home/user/pix-master/ /var/netcore
sudo nano /etc/systemd/system/Master.service
# Master.service – название сервиса для проекта.
[Unit]
Description=ASP .NET Web Application
[Service]
#Especifique la ruta del directorio donde está instalado el Asistente
WorkingDirectory=/var/netcore
ExecStart=/usr/bin/dotnet /var/netcore/Master.dll
Restart=always
RestartSec=10
SyslogIdentifier=netcore-demo
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
sudo systemctl enable Master.service
sudo systemctl start Master.service
sudo service apache2 status
sudo journalctl -fu Master.service