# ONOX Panel Virtual Host
# Bu dosya Ansible tarafından yönetilmektedir. Manuel düzenlemeyin.

<VirtualHost *:80>
    ServerName {{ onox_panel_hostname }}
    Redirect permanent / https://{{ onox_panel_hostname }}/
</VirtualHost>

<VirtualHost *:443>
    ServerName {{ onox_panel_hostname }}
    ServerAdmin {{ onox_admin_email }}
    DocumentRoot {{ onox_install_dir }}/public

    SSLEngine on
    SSLCertificateFile    /etc/letsencrypt/live/{{ onox_panel_hostname }}/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/{{ onox_panel_hostname }}/privkey.pem

    <Directory {{ onox_install_dir }}/public>
        AllowOverride All
        Options -Indexes +FollowSymLinks
        Require all granted
    </Directory>

    <FilesMatch \.php$>
        SetHandler "proxy:unix:/run/php-fpm/onox.sock|fcgi://localhost"
    </FilesMatch>

    ErrorLog  /var/log/httpd/onox-panel-error.log
    CustomLog /var/log/httpd/onox-panel-access.log combined

    # Laravel /up healthcheck — kimlik doğrulama bypass
    <Location /up>
        Order allow,deny
        Allow from all
        Satisfy any
    </Location>
</VirtualHost>
