Skip to content

Instantly share code, notes, and snippets.

@arkenidar
Created October 3, 2024 17:15
Show Gist options
  • Save arkenidar/c7b0d34c0f8d5d7ab46a5a9d9561d799 to your computer and use it in GitHub Desktop.
Save arkenidar/c7b0d34c0f8d5d7ab46a5a9d9561d799 to your computer and use it in GitHub Desktop.
server-side configuration snippets ( as documentation , quite safe to share , no secrets here , as backup too )
#### ssh arkenidar.com "cat /etc/apache2/sites-enabled/000-default-le-ssl.conf" > apache-site.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerName arkenidar.com
#ServerAlias arkenidar.me
ServerAdmin [email protected]
DocumentRoot /var/www/arkenidar.com
### bash shell: edit this file
# code /etc/apache2/sites-enabled/000-default-le-ssl.conf # edit conf.
# apachectl restart # apply configuration, way 1
# systemctl restart apache2 # apply configuration, way 2
# bash shell: security permissions
# chown www-data: /var/www -R
# just added
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/arkenidar.com>
AllowOverride All
# just added
Require all granted
#AddDefaultCharset UTF-8
# utf8 for html, php
AddDefaultCharset UTF-8
# utf8 for css, js, etc.
AddCharset UTF-8 .js .css .md
IndexOptions SuppressHTMLPreamble FancyIndexing
HeaderName /php/dirlist/dirlist-header.html
</Directory>
ProxyPass /spring/ http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
ProxyPass /myaspnet/ http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
ProxyPass /api/ http://localhost:5000/api/
ProxyPassReverse /api/ http://localhost:5000/api/
ProxyPass /swagger/ http://localhost:5000/swagger/
ProxyPassReverse /swagger/ http://localhost:5000/swagger/
#</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
# ALIASES
Alias /app/php_basics_router /var/www/apps/php_basics_router/www
## Alias /wordpress /var/www/wordpress
Alias /app/www-php /var/www/apps/www-php/www
#ServerName arkenidar.me # added above, commented here
#ServerAlias arkenidar.com # added above, commented here
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/arkenidar.com-0002/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/arkenidar.com-0002/privkey.pem
</VirtualHost>
</IfModule>
#### ssh arkenidar.com "cat /etc/systemd/system/dotnet_app1.service" > dotnet-systemd.service
[Unit]
Description=DotNet App 1
After=syslog.target
After=network.target[Service]
User=root
Type=simple
[Service]
### ExecStart=/usr/bin/bash /root/dotnet_app1.bash
WorkingDirectory=/root/dotnet_SimpleWebApi
ExecStart=/root/.dotnet/dotnet /root/dotnet_SimpleWebApi/bin/Debug/net8.0/SimpleWebApi.dll
# ExecStart=/root/.dotnet/dotnet run
### cd /root/dotnet_SimpleWebApi
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=dotnet_app1
[Install]
WantedBy=multi-user.target
#https://www.linode.com/docs/guides/how-to-deploy-spring-boot-applications-nginx-ubuntu-16-04/
# this is /etc/systemd/system/dotnet_app1.service
# systemctl start dotnet_app1.service
# systemctl status dotnet_app1.service
# systemctl enable dotnet_app1.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment