# Jupiter Hosting - Passenger Configuration
# For Python app at /livermore subdirectory

# Enable Passenger
PassengerEnabled On
PassengerAppRoot /home/yourusername/public_html/livermore

# Use Python 3
PassengerPython /usr/bin/python3

# Environment
SetEnv FLASK_ENV production

# Rewrite rules for subdirectory
RewriteEngine On
RewriteBase /livermore/

# Don't rewrite existing files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Route to WSGI app
RewriteRule ^(.*)$ passenger_wsgi.py/$1 [QSA,L]

# Disable directory listing
Options -Indexes

# Protect sensitive files
<FilesMatch "\.(env|py|pyc|log)$">
    Order allow,deny
    Deny from all
</FilesMatch>

# Allow access to dashboard.html and static files
<FilesMatch "\.(html|css|js|png|jpg|gif|ico)$">
    Allow from all
</FilesMatch>

# Error documents
ErrorDocument 500 /livermore/500.html
