echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc
echo 'HISTSIZE=-1' >> ~/.bashrc
echo 'HISTFILESIZE=-1' >> ~/.bashrc
source ~/.bashrc
timedatectl set-timezone Asia/Jerusalem
ufw allow ssh
ufw allow http
ufw allow https
echo y | ufw enable
ufw reload
apt install -y apache2 zip unzip php8.3 php8.3-curl php8.3-zip php8.3-soap php8.3-mysql php8.3-bcmath php8.3-mbstring php8.3-xml php8.3-xmlrpc php8.3-redis php8.3-imagick php8.3-gd php8.3-cli php8.3-common php8.3-intl mysql-server-8.0
find /etc/php/ -name "php.ini" -exec sh -c "echo 'date.timezone = Asia/Jerusalem' >> {}" \;
find /etc/php/*/apache2 -name "php.ini" -exec sed -i 's/128M/768M/g' {} \;
sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
a2dismod autoindex -f
a2enmod proxy proxy_http proxy_uwsgi proxy_wstunnel rewrite
systemctl enable apache2 --now
virtual host examples:
## for other vhost
<VirtualHost *:80>
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/other_vhosts_access.log
CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log combined
</VirtualHost>
## simple conf for http
<VirtualHost *:80>
ServerName *****.com
ServerAlias www.*****.com
DocumentRoot /var/www/*****
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
## for code server with proxy
<VirtualHost *:80>
ServerName cs.*****.com
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://localhost:8080/$1" [P,L]
ProxyRequests On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>