Hello all,
I have a number of Nginx/Apache based websites that I would like to convert to using Caddy, but I just am not sure how to get started. Attached is the config of one of the websites? How does this convert to Caddy speak?
Thanks,
Steve
``proxy_cache_path /var/cache/nginx/demo4.regulatoryintelligence.com_proxy levels=1:2 keys_zone=demo4.regulatoryintelligence.com_proxy:5m max_size=209715200;
server {
listen 10.0.2.21:443 quic;
add_header Alt-Svc ‘h3=“:443”; ma=86400’;
listen 10.0.2.21:443 ssl;
http2 on;
ssl_certificate /opt/psa/var/certificates/scfRIazSs;
ssl_certificate_key /opt/psa/var/certificates/scfRIazSs;
server_name www.demo4.regulatoryintelligence.com;
location / {
return 301 https://demo4.regulatoryintelligence.com$request_uri;
}
# mailconfig
location ~* ^/autodiscover/autodiscover\.xml$ {
try_files $uri @mad;
}
location ~* ^(/\.well-known/autoconfig)?/mail/config\-v1\.1\.xml$ {
try_files $uri @mad;
}
location ~* ^/email\.mobileconfig$ {
try_files $uri @mad;
}
location @mad {
rewrite ^(.*)$ /mailconfig/ break;
proxy_pass http://127.0.0.1:8880;
proxy_set_header X-Host $host;
proxy_set_header X-Request-URI $request_uri;
}
# mailconfig
}
server {
listen 10.0.2.21:443 quic;
add_header Alt-Svc ‘h3=“:443”; ma=86400’;
listen 10.0.2.21:443 ssl;
http2 on;
server_name demo4.regulatoryintelligence.com;
server_name ipv4.demo4.regulatoryintelligence.com;
ssl_certificate /opt/psa/var/certificates/scfRIazSs;
ssl_certificate_key /opt/psa/var/certificates/scfRIazSs;
client_max_body_size 134217728;
# mailconfig
location ~* ^/autodiscover/autodiscover\.xml$ {
try_files $uri @mad;
}
location ~* ^(/\.well-known/autoconfig)?/mail/config\-v1\.1\.xml$ {
try_files $uri @mad;
}
location ~* ^/email\.mobileconfig$ {
try_files $uri @mad;
}
location @mad {
rewrite ^(.*)$ /mailconfig/ break;
proxy_pass http://127.0.0.1:8880;
proxy_set_header X-Host $host;
proxy_set_header X-Request-URI $request_uri;
}
# mailconfig
access_log "/var/www/vhosts/system/demo4.regulatoryintelligence.com/logs/proxy_access_ssl_log";
error_log "/var/www/vhosts/system/demo4.regulatoryintelligence.com/logs/proxy_error_log";
root "/var/www/vhosts/demo4.regulatoryintelligence.com/httpdocs";
add_header X-Cache-Status $upstream_cache_status;
set $no_cache "";
set $cache_cookie $http_cookie;
if ($cache_cookie !~ "^\s*$") {
set $no_cache 1;
}
#extension performance-booster begin
# Additional directives added by Plesk Optimization Settings
open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1024;
gzip_comp_level 2;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript application/json;
brotli_comp_level 3;
brotli_min_length 1024;
# Additional directives added by Plesk Optimization Settings
#extension performance-booster end
#extension sslit begin
add_header Strict-Transport-Security "max-age=15768000" always;
#OCSP Stapling
ssl_stapling on;
ssl_stapling_verify on;
#extension sslit end
#extension letsencrypt begin
location ^~ /.well-known/acme-challenge/ {
root /var/www/vhosts/default/htdocs;
types { }
default_type text/plain;
satisfy any;
auth_basic off;
allow all;
location ~ ^/\.well-known/acme-challenge.*/\. {
deny all;
}
}
#extension letsencrypt end
location / {
proxy_pass https://127.0.0.1:7081;
proxy_hide_header upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log off;
proxy_cache_key "$scheme$request_method$host$request_uri";
proxy_no_cache $no_cache $http_pragma $http_authorization $arg_nocache;
proxy_cache_bypass $no_cache $http_pragma $http_authorization $arg_nocache;
proxy_cache demo4.regulatoryintelligence.com_proxy;
proxy_cache_valid "5";
proxy_cache_use_stale http_500 http_502 http_503 http_504 updating;
proxy_cache_background_update on;
}
location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
proxy_pass https://127.0.0.1:7081;
proxy_hide_header upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log off;
proxy_cache_key "$scheme$request_method$host$request_uri";
proxy_no_cache $no_cache $http_pragma $http_authorization $arg_nocache;
proxy_cache_bypass $no_cache $http_pragma $http_authorization $arg_nocache;
proxy_cache demo4.regulatoryintelligence.com_proxy;
proxy_cache_valid "5";
proxy_cache_use_stale http_500 http_502 http_503 http_504 updating;
proxy_cache_background_update on;
}
location @fallback {
proxy_pass https://127.0.0.1:7081;
proxy_hide_header upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log off;
proxy_cache_key "$scheme$request_method$host$request_uri";
proxy_no_cache $no_cache $http_pragma $http_authorization $arg_nocache;
proxy_cache_bypass $no_cache $http_pragma $http_authorization $arg_nocache;
proxy_cache demo4.regulatoryintelligence.com_proxy;
proxy_cache_valid "5";
proxy_cache_use_stale http_500 http_502 http_503 http_504 updating;
proxy_cache_background_update on;
}
location ~ ^/(.*\.(ac3|avi|bmp|bz2|css|cue|dat|doc|docx|dts|eot|exe|flv|gif|gz|htm|html|ico|img|iso|jpeg|jpg|js|mkv|mp3|mp4|mpeg|mpg|ogg|pdf|png|ppt|pptx|qt|rar|rm|svg|swf|tar|tgz|ttf|txt|wav|woff|woff2|xls|xlsx|zip|webp))$ {
try_files $uri @fallback;
}
disable_symlinks if_not_owner "from=/var/www/vhosts/demo4.regulatoryintelligence.com";
add_header X-Powered-By PleskLin;
include "/var/www/vhosts/system/demo4.regulatoryintelligence.com/conf/vhost_nginx.conf";
}
server {
listen 10.0.2.21:80;
server_name www.demo4.regulatoryintelligence.com;
location / {
return 301 https://demo4.regulatoryintelligence.com$request_uri;
}
# mailconfig
location ~* ^/autodiscover/autodiscover\.xml$ {
try_files $uri @mad;
}
location ~* ^(/\.well-known/autoconfig)?/mail/config\-v1\.1\.xml$ {
try_files $uri @mad;
}
location ~* ^/email\.mobileconfig$ {
try_files $uri @mad;
}
location @mad {
rewrite ^(.*)$ /mailconfig/ break;
proxy_pass http://127.0.0.1:8880;
proxy_set_header X-Host $host;
proxy_set_header X-Request-URI $request_uri;
}
# mailconfig
}
server {
listen 10.0.2.21:80;
server_name demo4.regulatoryintelligence.com;
server_name ipv4.demo4.regulatoryintelligence.com;
client_max_body_size 134217728;
# mailconfig
location ~* ^/autodiscover/autodiscover\.xml$ {
try_files $uri @mad;
}
location ~* ^(/\.well-known/autoconfig)?/mail/config\-v1\.1\.xml$ {
try_files $uri @mad;
}
location ~* ^/email\.mobileconfig$ {
try_files $uri @mad;
}
location @mad {
rewrite ^(.*)$ /mailconfig/ break;
proxy_pass http://127.0.0.1:8880;
proxy_set_header X-Host $host;
proxy_set_header X-Request-URI $request_uri;
}
# mailconfig
access_log "/var/www/vhosts/system/demo4.regulatoryintelligence.com/logs/proxy_access_log";
error_log "/var/www/vhosts/system/demo4.regulatoryintelligence.com/logs/proxy_error_log";
location / {
return 301 https://$host$request_uri;
}
}``