domain and subdomain with same root folder but different certificates
Posted: Tue Jan 02, 2018 3:01 pm
Hi
I have one domain, domain.ml, with let's encrypt enable on it. I want to have a subdomain of domain.com (admin.domain.ml) with its own certificate.
For this I added a CNAME record admin to domain.mland create a new web (site) admin.domain.ml and enable let's encrypt on it.
I also modified the apache and nginx conf like this
The result is:
I have one domain, domain.ml, with let's encrypt enable on it. I want to have a subdomain of domain.com (admin.domain.ml) with its own certificate.
For this I added a CNAME record admin to domain.mland create a new web (site) admin.domain.ml and enable let's encrypt on it.
I also modified the apache and nginx conf like this
Code: Select all
<VirtualHost 1.1.1.1:8080>
ServerName admin.domain.ml
ServerAlias www.admin.domain.ml
ServerAdmin [email protected]
DocumentRoot /home/admin/web/domain.ml/public_html
ScriptAlias /cgi-bin/ /home/admin/web/admin.domain.ml/cgi-bin/
Alias /vstats/ /home/admin/web/admin.domain.ml/stats/
Alias /error/ /home/admin/web/admin.domain.ml/document_errors/
#SuexecUserGroup admin admin
CustomLog /var/log/httpd/domains/admin.domain.ml.bytes bytes
CustomLog /var/log/httpd/domains/admin.domain.ml.log combined
ErrorLog /var/log/httpd/domains/admin.domain.ml.error.log
<Directory /home/admin/web/domain.ml/public_html>
AllowOverride All
Options +Includes -Indexes +ExecCGI
php_admin_value open_basedir /home/admin/web/admin.domain.ml/public_html:/home/admin/tmp
php_admin_value upload_tmp_dir /home/admin/tmp
php_admin_value session.save_path /home/admin/tmp
</Directory>
<Directory /home/admin/web/admin.domain.ml/stats>
AllowOverride All
</Directory>
<IfModule mod_ruid2.c>
RMode config
RUidGid admin admin
RGroups apache
</IfModule>
<IfModule itk.c>
AssignUserID admin admin
</IfModule>
IncludeOptional /home/admin/conf/web/httpd.admin.domain.ml.conf*
</VirtualHost>
Code: Select all
server {
listen 1.1.1.1:80;
server_name admin.domain.ml www.admin.domain.ml;
error_log /var/log/httpd/domains/admin.domain.ml.error.log error;
location / {
proxy_pass http://1.1.1.1:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|od$
root /home/admin/web/domain.ml/public_html;
access_log /var/log/httpd/domains/admin.domain.ml.log combined;
access_log /var/log/httpd/domains/admin.domain.ml.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/admin.domain.ml/document_errors/;
}
location @fallback {
proxy_pass http://1.1.1.1:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.admin.domain.ml.conf*;
}
- http://admin.domain.ml display the same that domain.ml
- https://admin.domain.ml display the default page of admin.domain.ml