Mithu Posted September 21, 2024 Report Posted September 21, 2024 Please help me, I've set nginx Template for Blesta on HestiaCP. blesta.tpl - server { listen %ip%:%web_port%; server_name %domain_idn% %alias_idn%; # Root location block (Update %docroot%/blesta to your own Directory / @blesta is Default) root %docroot%/blesta; index index.php index.html index.htm; access_log /var/log/nginx/domains/%domain%.log combined; access_log /var/log/nginx/domains/%domain%.bytes bytes; error_log /var/log/nginx/domains/%domain%.error.log error; include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*; # Security: Prevent access to hidden files location ~ /\.(?!well-known\/) { deny all; return 404; } # Main location block (Update @blesta to your own Directory / @blesta is Default) location / { try_files $uri @blesta; rewrite ^(.*)/install\.php$ /$1/install/ redirect; } # PHP-FPM configuration for index.php location = /index.php { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass %backend_lsnr%; include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*; } # Security: Block access to certain file types location ~ /\. { log_not_found off; return 404; } location ~* \.(php|pdt|txt)$ { log_not_found off; return 404; } # Error handling location /error/ { alias %home%/%user%/web/%domain%/application/app/views/errors/; } # Stats location /vstats/ { alias %home%/%user%/web/%domain%/stats/; include %home%/%user%/web/%domain%/stats/auth.conf*; } # Include additional configurations include /etc/nginx/conf.d/phpmyadmin.inc*; include /etc/nginx/conf.d/phppgadmin.inc*; include %home%/%user%/conf/web/%domain%/nginx.conf_*; # Core rewrite (Update @blesta to your own Directory / @blesta is Default) location @blesta { rewrite ^(.*)$ /index.php?$1 last; } } blesta.stpl - server { listen %ip%:%web_ssl_port% ssl; server_name %domain_idn% %alias_idn%; # Root location block (Update %docroot%/blesta to your own Directory / @blesta is Default) root %sdocroot%/blesta; index index.php index.html index.htm; access_log /var/log/nginx/domains/%domain%.log combined; access_log /var/log/nginx/domains/%domain%.bytes bytes; error_log /var/log/nginx/domains/%domain%.error.log error; ssl_certificate %ssl_pem%; ssl_certificate_key %ssl_key%; ssl_stapling on; ssl_stapling_verify on; # TLS 1.3 0-RTT anti-replay if ($anti_replay = 307) { return 307 https://$host$request_uri; } if ($anti_replay = 425) { return 425; } # Security: HSTS include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*; # Security: Prevent access to hidden files location ~ /\.(?!well-known\/) { deny all; return 404; } # Main location block (Update @blesta to your own Directory / @blesta is Default) location / { try_files $uri @blesta; rewrite ^(.*)/install\.php$ /$1/install/ redirect; } # PHP-FPM configuration for index.php location = /index.php { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTP_EARLY_DATA $rfc_early_data if_not_empty; fastcgi_pass %backend_lsnr%; include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*; } # Security: Block access to certain file types location ~ /\. { log_not_found off; return 404; } location ~* \.(php|pdt|txt)$ { log_not_found off; return 404; } # Error handling location /error/ { alias %home%/%user%/web/%domain%/application/app/views/errors/; } # Stats location /vstats/ { alias %home%/%user%/web/%domain%/stats/; include %home%/%user%/web/%domain%/stats/auth.conf*; } # Include additional configurations include /etc/nginx/conf.d/phpmyadmin.inc*; include /etc/nginx/conf.d/phppgadmin.inc*; include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*; # Core rewrite (Update @blesta to your own Directory / @blesta is Default) location @blesta { rewrite ^(.*)$ /index.php?$1 last; } } All are working, error Page not Working & also feed / API call not working, please help me to modify this for perfect work with Blesta Billing. Thanks in Advance. Quote
Paul Posted September 23, 2024 Report Posted September 23, 2024 We have a sample configuration for Nginx here https://docs.blesta.com/display/user/Installing+Blesta#InstallingBlesta-Nginx but Nginx use should be reserved for experts. The sample config is reported to work pretty well, but that doesn't mean it's perfect. If you've copied the important bits from the sample config and still have problems, you might consider switching to Apache. Mithu 1 Quote
dddcodigo26 Posted October 1, 2024 Report Posted October 1, 2024 To create an Nginx template for HestiaCP, you can customize the default configuration file located in `/usr/local/hestia/data/templates/nginx/`. Modify the template as needed, ensuring you include necessary directives for your specific applications and security settings. Don't forget to reload Nginx after making changes using `sudo systemctl reload nginx`. Mithu 1 Quote
VegasX Posted October 1, 2024 Report Posted October 1, 2024 To set up an Nginx template for HestiaCP, you can create a custom configuration by editing the default Nginx templates in the control panel. This allows for tailored caching, proxy settings, or any specific web app configurations. For more information on setting up the vegas x org casino app download, make sure to configure your server for optimal performance and security. Mithu 1 Quote
Mithu Posted October 2, 2024 Author Report Posted October 2, 2024 I've Solved HestiaCP Blesta nginX Template. Here are my Template - HestiaCP nginX Template for Blesta Paul 1 Quote
smithsteve Posted October 22, 2024 Report Posted October 22, 2024 To set up Nginx for Blesta on HestiaCP, you need to ensure your Nginx configuration file is correctly set up. Here’s a basic template to get you started: 1. **Create a Configuration File**: In the Nginx configuration directory, create a file for Blesta, typically found at `/etc/nginx/sites-available/yourdomain.conf`. 2. **Basic Nginx Template**: ```nginx server { listen 80; server_name yourdomain.com; # Replace with your domain root /path/to/blesta; # Path to your Blesta installation index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.x-fpm.sock; # Adjust PHP version as needed fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } } ``` 3. **Enable the Site**: Link the configuration file in the `sites-enabled` directory: ```bash ln -s /etc/nginx/sites-available/yourdomain.conf /etc/nginx/sites-enabled/ ``` 4. **Test Nginx Configuration**: ```bash sudo nginx -t ``` 5. **Restart Nginx**: ```bash sudo systemctl restart nginx ``` 6. **Set Permissions**: Ensure your Blesta installation has the correct permissions for the web server to read and write files. After setting this up, your Blesta should be accessible through your domain. If you encounter any issues, check the Nginx error logs for more details. Paul 1 Quote
Nouman Ali Posted October 26, 2024 Report Posted October 26, 2024 I can help with that! Are you having any specific issues with the Nginx template, or do you need guidance on the overall setup for Blesta on HestiaCP Quote
freelancers238 Posted February 7 Report Posted February 7 It looks like your Nginx configuration for Blesta on HestiaCP is mostly correct, but the error pages and API calls aren’t working. Here are some potential fixes and modifications you can apply: 1. Fix Error Pages Not Working 2. Fix API Calls & Feed Not Working 3. Ensure Proper API Rewrite Handling 4. Restart Nginx & Debug Logs Quote
freelancers238 Posted February 7 Report Posted February 7 Fix Error Pages Not Working Your error handling configuration is likely not working due to incorrect aliasing or missing directives. Quote
AhsanAfzal7 Posted Sunday at 03:01 AM Report Posted Sunday at 03:01 AM Edit the template in `/usr/local/hestia/data/templates/nginx/`, then reload Nginx: Quote bash sudo systemctl reload nginx Quote
AhsanAfzal7 Posted Sunday at 03:02 AM Report Posted Sunday at 03:02 AM You can modify the Nginx template in /usr/local/hestia/data/templates/nginx/ to suit your needs. After making changes, reload Nginx to apply them. Quote
Nouman Ali Posted Wednesday at 03:11 AM Report Posted Wednesday at 03:11 AM I'm using HestiaCP with an Nginx template for Blesta, and while most things work fine, I'm facing issues with the error pages not displaying correctly and API calls or feed endpoints not functioning as expected. Below is my current Nginx configuration for both HTTP and HTTPS. I suspect the problem might be related to missing rewrite rules or improper handling of error pages and API routes. Any insights or modifications to make this work perfectly with Blesta Billing would be greatly appreciated. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.