-
-
Save Bharat-B/6ba2e18f85591c77fdf00ad7334fb9c6 to your computer and use it in GitHub Desktop.
server { | |
listen 80 default_server; | |
server_name readydedis.com www.readydedis.com; | |
return 301 https://readydedis.com$request_uri; | |
} | |
# HTTPS server | |
# | |
server { | |
listen 443; | |
server_name readydedis.com; | |
root /var/www/html/public; | |
access_log /var/log/nginx/readydedis.com-access_log; | |
error_log /var/log/nginx/readydedis.com-error_log; | |
add_header X-Frame-Options "SAMEORIGIN"; | |
add_header X-XSS-Protection "1; mode=block"; | |
add_header X-Content-Type-Options "nosniff"; | |
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always; | |
index index.php index.html index.htm; | |
charset utf-8; | |
ssl on; | |
ssl_certificate /var/www/html/storage/ssl/cert.pem; | |
ssl_certificate_key /var/www/html/storage/ssl/cert.key; | |
ssl_session_timeout 5m; | |
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; | |
ssl_prefer_server_ciphers on; | |
location ~ /clients/admin/(client!\.php|client/(.*)|table/(.*)|search!\.php|search/(.*)|apps|billing|setup|user|services|addons|domains|utilitiesemailmarketer!\.php|utilities/(.*)|logs|help!\.php|help/license|modules|image/(recent|upload)|validation_com/(.*))/?(.*)$ { | |
rewrite ^/(.*)$ /clients/admin/index.php?rp=/admin/$1/$2; | |
} | |
location ~ /clients/(images/em|invoice|login|password|account|store|download|knowledgebase|announcements|clientarea/ssl-certificates|user/(verification|accounts|profile|password|security|verify)|cart/(domain/renew)|domain/pricing|cart/order|images/kb)/?(.*)$ { | |
rewrite ^/(.*)$ /clients/index.php?rp=/$1/$2; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location = /favicon.ico { access_log off; log_not_found off; } | |
location = /robots.txt { access_log off; log_not_found off; } | |
error_page 404 /index.php; | |
proxy_send_timeout 300s; | |
proxy_read_timeout 300s; | |
location ~ \.php$ { | |
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; | |
fastcgi_send_timeout 300; | |
fastcgi_read_timeout 300; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location ~ /\.(?!well-known).* { | |
deny all; | |
} | |
location ^~ /clients/vendor/ { | |
deny all; | |
return 403; | |
} | |
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|svg|woff|woff2|ttf)\$ { | |
expires 1M; | |
access_log off; | |
add_header Cache-Control "public"; | |
} | |
location ~* \.(?:css|js)\$ { | |
expires 7d; | |
access_log off; | |
add_header Cache-Control "public"; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Hi Marcel, from my whmcs installation I can't use the "Login as Owner" function, the URL stays at:
https://domainname.com/whmcs/admin/client/1/login
Where 1 = clientID
And I can't get in.
I have checked all the configuration lines more than once and they are exactly the same as the ones I have in nginx, could you share your configuration please?
Hi jorgefduran,
Maybe the issue is the /whmcs/. I certainly wouldn't be surprised because WHMCS is just weird. I'm currently not at home so i'm not able login in my aaPanel to copy my configuration because of me not remember my 32 char password ^^
I understand, if it were possible to do it when you are at your home I would greatly appreciate it.
@jorgefduran for it to work for you you should replace /clients/ in the nginx config on line 36 and 40 with /whmcs/
@Bharat-B, yes I have replaced, with my own path.
Sorry... was my mistake... my custom admin directory was missing in the config. Thank you @Bharat-B and @Marcel-Baumgartner
No problem ^^
Any idea why the login doesn't work with this conf? login.php shows 404 and admin login page .css not loading. When I remove this section, they work.
location ~ /(images/em|invoice|login|password|account|store|download|knowledgebase|announcements|clientarea/ssl-certificates|user/(verification|accounts|profile|password|security|verify)|cart/(domain/renew)|domain/pricing|cart/order|images/kb)/?(.*)$ { rewrite ^/(.*)$ /index.php?rp=/$1/$2; }
I have WHMCS installed in the root, that's why I have removed the clients path from here.
Also having the same issue that Login isnt working.
Same issue as the two commenters above on a new install. Interestingly, it's working fine on another installation I have.
Having issues with domainchecker.php returning a 404 error. I've even disabled friendly URLS and still get that issue. Anyone have any ideas?
Having issues with domainchecker.php returning a 404 error. I've even disabled friendly URLS and still get that issue. Anyone have any ideas?
Every version has newer links and routes, this specific nginx config is for an older one, please reach out to me on +91 8686927397 I'll help :)
//For Admin area
location ~ /clients/admin/(client!\.php|client/(.*)|table/(.*)|search!\.php|search/(.*)|apps|billing|setup|user|services|addons|account/(.*)|domains|utilitiesemailmarketer!\.php|utilities/(.*)|logs|help!\.php|help/license|modules|image/(recent|upload)|validation_com/(.*))/?(.*)$ {
rewrite ^/(.*)$ /clients/admin/index.php?rp=/admin/$1/$2;
//For clientarea
location ~ /clients/(invite|images/em|invoice|login|password|account|store|download|knowledgebase|announcements|clientarea/ssl-certificates|user/(verification|accounts|profile|password|security|verify)|cart/(domain/renew)|domain/pricing|cart/order|images/kb)/?(.*)$ {
rewrite ^/(.*)$ /clients/index.php?rp=/$1/$2;
}
//For Admin area location ~ /clients/admin/(client!\.php|client/(.*)|table/(.*)|search!\.php|search/(.*)|apps|billing|setup|user|services|addons|account/(.*)|domains|utilitiesemailmarketer!\.php|utilities/(.*)|logs|help!\.php|help/license|modules|image/(recent|upload)|validation_com/(.*))/?(.*)$ { rewrite ^/(.*)$ /clients/admin/index.php?rp=/admin/$1/$2; //For clientarea location ~ /clients/(invite|images/em|invoice|login|password|account|store|download|knowledgebase|announcements|clientarea/ssl-certificates|user/(verification|accounts|profile|password|security|verify)|cart/(domain/renew)|domain/pricing|cart/order|images/kb)/?(.*)$ { rewrite ^/(.*)$ /clients/index.php?rp=/$1/$2; }
Fantastic! Thank you, this works with WHMCS v8.8
I'm using NGINX too and its working fine ^^