Last active
August 3, 2023 12:54
-
-
Save generahben/2f7e31203d4e80cfb7076bcef78aa992 to your computer and use it in GitHub Desktop.
DotNet Core Deployement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install DotNet | |
---------------- | |
lsb_release -a => Learn Ubuntu Version and Details | |
Visit Microsoft website for steps to install .Net | |
Copy from Ftp folder to working folder | |
-------------------------------------- | |
sudo cp -a /var/sftp/myfolder/data/publish/* /var/www/webapi/ | |
cd /var/www/webapi/ | |
sudo chmod 770 * | |
sudo chown -R $USER:$USER * | |
sudo nano /etc/systemd/system/webapi.service | |
[Unit] | |
Description=ASP .NET Web Application | |
[Service] | |
WorkingDirectory=/var/www/webapi | |
ExecStart=/usr/share/dotnet/dotnet /var/www/webapi/WebApplicationIOT.dll | |
Restart=always | |
RestartSec=10 | |
SyslogIdentifier=netcore-demo | |
User=www-data | |
Environment=ASPNETCORE_ENVIRONMENT=Production | |
[Install] | |
WantedBy=multi-user.target | |
"Restart service daemon" | |
------------------------ | |
sudo systemctl daemon-reload | |
sudo systemctl enable webapi.service | |
sudo systemctl start webapi | |
sudo systemctl status webapi | |
<VirtualHost *:443> | |
ProxyPreserveHost On | |
ProxyPass / http://localhost:8000/ | |
ProxyPassReverse / http://localhost:8000/ | |
ServerName api.domain-name.com | |
ErrorLog ${APACHE_LOG_DIR}domain0name-error.log | |
CustomLog ${APACHE_LOG_DIR}domain-name-access.log common | |
SSLEngine on | |
SSLCertificateFile /etc/ssl/certs/domain-name.com.crt | |
SSLCertificateKeyFile /etc/ssl/certs/domain-name.com.key | |
</VirtualHost> | |
openssl req -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out domain-name.com.crt -keyout domain-name.com.key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment