# ============================================================
# Domains / Subdomains in this config (for quick reference)
# ============================================================
# pajoohyar.ir
# www.pajoohyar.ir
# cloud.pajoohyar.ir
# core.pajoohyar.ir
# dev.pajoohyar.ir
# dev-core.pajoohyar.ir
# dev-mylib.pajoohyar.ir
# dl.pajoohyar.com
# metadata.pajoohyar.ir
# mylib.pajoohyar.ir
# mysql.pajoohyar.ir
# newsletter.pajoohyar.ir
# popup.pajoohyar.ir
# site.pajoohyar.ir
# update.pajoohyar.ir
# wiki.pajoohyar.ir
#
# Commented/disabled vhosts kept below (unchanged logically):
# lib-core.pajoohyar.ir
# dev-lib-core.pajoohyar.ir
# cite.pajoohyar.ir
# blog.pajoohyar.ir
# dev-cite.pajoohyar.ir
# ============================================================


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName pajoohyar.ir
		ServerAlias www.pajoohyar.ir

		RedirectMatch ^/sites/all/libraries/app/updater/(.*)$ https://dl.pajoohyar.com/sites/all/libraries/app/updater/$1
		RedirectMatch ^/download/xpdf/(.*)$ https://dl.pajoohyar.com/download/xpdf/$1

		DocumentRoot /var/www/html/pajoohyar/builds/main/build

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		Header always set Strict-Transport-Security "max-age=86400"

		SSLEngine on

		Include /etc/letsencrypt/options-ssl-apache.conf
		SSLCertificateFile /etc/ssl/pajoohyar-main/fullchain.pem
		SSLCertificateKeyFile /etc/ssl/pajoohyar-main/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName cloud.pajoohyar.ir
		ServerAdmin webmaster@localhost

		DocumentRoot /var/www/html/pajoohyar/cloud/build/

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		RewriteEngine on

		Header always set Strict-Transport-Security "max-age=86400"

		Include /etc/letsencrypt/options-ssl-apache.conf
		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName core.pajoohyar.ir

		DocumentRoot /var/www/html/newpajoohyar/core/public/

		ErrorLog ${APACHE_LOG_DIR}/errorcore.log
		CustomLog ${APACHE_LOG_DIR}/accesscore.log combined

		ProxyPreserveHost On
		ProxyPass / http://127.0.0.1:9000/
		ProxyPassReverse / http://127.0.0.1:9000/

		SSLEngine On

		Include /etc/letsencrypt/options-ssl-apache.conf
		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName dev.pajoohyar.ir
		ServerAdmin webmaster@localhost

		DocumentRoot /var/www/html/newpajoohyar/site/builds/dev/build

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		RewriteEngine on

		Header always set Strict-Transport-Security "max-age=86400"

		Include /etc/letsencrypt/options-ssl-apache.conf
		SSLCertificateFile /etc/ssl/pajoohyar-main/fullchain.pem
		SSLCertificateKeyFile /etc/ssl/pajoohyar-main/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName dev-core.pajoohyar.ir
		ServerAdmin webmaster@localhost

		DocumentRoot /var/www/html/pajoohyar/dev-core/public

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		RewriteEngine on

		Include /etc/letsencrypt/options-ssl-apache.conf
		Header always set Strict-Transport-Security "max-age=86400"
		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName dev-mylib.pajoohyar.ir
		ServerAdmin webmaster@localhost

		DocumentRoot /var/www/html/pajoohyar/builds/mylib-dev/build

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		RewriteEngine on

		Include /etc/letsencrypt/options-ssl-apache.conf
		Header always set Strict-Transport-Security "max-age=86400"
		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName dl.pajoohyar.com

		DocumentRoot /var/www/html/newpajoohyar/
		AliasMatch ^/sites/all/libraries/app/updater/(.*)$ /var/www/html/newpajoohyar/updates/client-update/$1

		<Directory /var/www/html/newpajoohyar/updates/client-update>
			Options Indexes FollowSymLinks
			AllowOverride All
			Require all granted
		</Directory>

		ErrorLog ${APACHE_LOG_DIR}/dlerror.log
		CustomLog ${APACHE_LOG_DIR}/dlaccess.log combined

		Include /etc/letsencrypt/options-ssl-apache.conf
		SSLCertificateFile /etc/ssl/dl-pajoohyar/fullchain.pem
		SSLCertificateKeyFile /etc/ssl/dl-pajoohyar/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName metadata.pajoohyar.ir
		ServerAdmin webmaster@localhost

		ProxyPreserveHost On
		ProxyPass /api/ http://localhost:5050/
		ProxyPassReverse /api/ http://localhost:5050/

		DocumentRoot /var/www/html/pajoohyar/metadata/build

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		Options Indexes MultiViews
		RewriteEngine on

		Include /etc/letsencrypt/options-ssl-apache.conf
		Header always set Strict-Transport-Security "max-age=86400"
		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName mylib.pajoohyar.ir
		ServerAdmin webmaster@localhost

		DocumentRoot /var/www/html/pajoohyar/builds/mylib/build

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		RewriteEngine on

		Include /etc/letsencrypt/options-ssl-apache.conf
		Header always set Strict-Transport-Security "max-age=86400"
		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName mysql.pajoohyar.ir
		ServerAdmin webmaster@localhost

		DocumentRoot /var/www/phpmyadmin

		ProxyPreserveHost On
		ProxyPass / http://127.0.0.1:8081/
		ProxyPassReverse / http://127.0.0.1:8081/

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		RewriteEngine on

		Include /etc/letsencrypt/options-ssl-apache.conf
		Header always set Strict-Transport-Security "max-age=86400"
		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName newsletter.pajoohyar.ir
		ServerAdmin webmaster@localhost

		DocumentRoot /var/www/html/narenji-front/build/

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		RewriteEngine on

		Include /etc/letsencrypt/options-ssl-apache.conf
		Header always set Strict-Transport-Security "max-age=86400"
		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName popup.pajoohyar.ir
		ServerAdmin webmaster@localhost

		DocumentRoot /var/www/html/pajoohyar/extenral-popup

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		Include /etc/letsencrypt/options-ssl-apache.conf
		Header always set Strict-Transport-Security "max-age=86400"
		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName site.pajoohyar.ir
		ServerAdmin webmaster@localhost

		ProxyPreserveHost On
		ProxyRequests Off

		DocumentRoot /var/www/html/narenji/public

		ProxyPass /socket http://localhost:5156
		ProxyPassReverse /socket http://localhost:5156

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		Include /etc/letsencrypt/options-ssl-apache.conf
		Header always set Strict-Transport-Security "max-age=86400"
		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName update.pajoohyar.ir

		ProxyPreserveHost On
		ProxyPass / http://localhost:3000/
		ProxyPassReverse / http://localhost:3000/

		ErrorLog ${APACHE_LOG_DIR}/update-error.log
		CustomLog ${APACHE_LOG_DIR}/update-access.log combined

		Include /etc/letsencrypt/options-ssl-apache.conf
		Header always set Strict-Transport-Security "max-age=86400"
		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
	</VirtualHost>
</IfModule>


<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerName wiki.pajoohyar.ir
		ServerAdmin webmaster@localhost

		DocumentRoot /var/www/html/pajoohyar/wiki/

		ErrorLog ${APACHE_LOG_DIR}/error.log
		CustomLog ${APACHE_LOG_DIR}/access.log combined

		RewriteEngine on

		Include /etc/letsencrypt/options-ssl-apache.conf
		Header always set Strict-Transport-Security "max-age=86400"
		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
	</VirtualHost>
</IfModule>


# ------------------------------------------------------------
# Disabled / commented vhosts (kept, but cleaned for readability)
# ------------------------------------------------------------

# <IfModule mod_ssl.c>
# 	<VirtualHost *:443>
# 		ServerName lib-core.pajoohyar.ir
# 		ServerAdmin webmaster@localhost
# 		DocumentRoot /var/www/html/pajoohyar/online-library-backend-laravel/public
#
# 		ErrorLog ${APACHE_LOG_DIR}/error.log
# 		CustomLog ${APACHE_LOG_DIR}/access.log combined
#
# 		RewriteEngine on
#
# 		Include /etc/letsencrypt/options-ssl-apache.conf
# 		Header always set Strict-Transport-Security "max-age=86400"
# 		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
# 		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
# 	</VirtualHost>
# </IfModule>


# <IfModule mod_ssl.c>
# 	<VirtualHost *:443>
# 		ServerName dev-lib-core.pajoohyar.ir
# 		ServerAlias dev-lib-core.pajoohyar.ir
# 		ServerAdmin webmaster@localhost
#
# 		DocumentRoot /var/www/html/test/src
#
# 		ErrorLog ${APACHE_LOG_DIR}/error.log
# 		CustomLog ${APACHE_LOG_DIR}/access.log combined
#
# 		RewriteEngine on
#
# 		Include /etc/letsencrypt/options-ssl-apache.conf
# 		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
# 		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
# 	</VirtualHost>
# </IfModule>


# <IfModule mod_ssl.c>
# 	<VirtualHost *:443>
# 		ServerName cite.pajoohyar.ir
# 		ServerAdmin webmaster@localhost
#
# 		# DocumentRoot /var/www/html/pajoohyar/builds/cite/build
#
# 		<FilesMatch "\.php$">
# 			SetHandler "proxy:fcgi://127.0.0.1:8085"
# 		</FilesMatch>
#
# 		ErrorLog ${APACHE_LOG_DIR}/error.log
# 		CustomLog ${APACHE_LOG_DIR}/access.log combined
#
# 		Include /etc/letsencrypt/options-ssl-apache.conf
# 		Header always set Strict-Transport-Security "max-age=86400"
#
# 		SSLCertificateFile /etc/letsencrypt/live/cite.pajoohyar.ir-0002/fullchain.pem
# 		SSLCertificateKeyFile /etc/letsencrypt/live/cite.pajoohyar.ir-0002/privkey.pem
# 	</VirtualHost>
# </IfModule>


# <IfModule mod_ssl.c>
# 	<VirtualHost *:443>
# 		ServerName blog.pajoohyar.ir
# 		ServerAdmin webmaster@localhost
#
# 		RewriteEngine On
#
# 		ErrorLog ${APACHE_LOG_DIR}/error.log
# 		CustomLog ${APACHE_LOG_DIR}/access.log combined
#
# 		Include /etc/letsencrypt/options-ssl-apache.conf
# 		Header always set Strict-Transport-Security "max-age=31536000"
#
# 		SSLCertificateFile /etc/letsencrypt/live/pajoohyar.ir/fullchain.pem
# 		SSLCertificateKeyFile /etc/letsencrypt/live/pajoohyar.ir/privkey.pem
# 	</VirtualHost>
# </IfModule>


# <IfModule mod_ssl.c>
# 	<VirtualHost *:443>
# 		ServerName dev-cite.pajoohyar.ir
# 		ServerAdmin webmaster@localhost
#
# 		DocumentRoot /var/www/html/pajoohyar/dev-cite/build
#
# 		ErrorLog ${APACHE_LOG_DIR}/error.log
# 		CustomLog ${APACHE_LOG_DIR}/access.log combined
#
# 		RewriteEngine on
#
# 		Include /etc/letsencrypt/options-ssl-apache.conf
# 		Header always set Strict-Transport-Security "max-age=86400"
# 		SSLCertificateFile /etc/letsencrypt/live/blog.pajoohyar.ir-0001/fullchain.pem
# 		SSLCertificateKeyFile /etc/letsencrypt/live/blog.pajoohyar.ir-0001/privkey.pem
# 	</VirtualHost>
# </IfModule>
