|
本帖最后由 xiaoxiao 于 2015-4-4 23:12 编辑
首先在面板上按照常规方式创建网站,这里我创建了网站 dns.diledns.com
当网站创建成功后,在系统目录 /www/wdlinux/nginx/conf/vhost 下会生成站点的配置文件
切换到相关目录
- cd /www/wdlinux/nginx/conf/vhost
复制代码
使用 ls 命令查看相关站点配置文件,我这里生成的是 dns.diledns.com.conf
打开编辑
打开后默认的文件配置如下
- server {
- listen 80;
- server_name dns.diledns.com;
- root /www/web/diledns/public_html;
- index index.html index.php index.htm;
- error_page 400 /errpage/400.html;
- error_page 403 /errpage/403.html;
- error_page 404 /errpage/404.html;
- location ~ \.php$ {
- proxy_pass http://127.0.0.1:88;
- include naproxy.conf;
- }
- location / {
- try_files $uri @apache;
- }
- location @apache {
- proxy_pass http://127.0.0.1:88;
- include naproxy.conf;
- }
- }
复制代码
我们需要加入ssl的监听端口及证书文件的目录位置
主要是以下3项
listen 443 ssl;
ssl_certificate /root/dns.diledns.com.crt;
ssl_certificate_key /root/dns.diledns.com.key;
加入ssl配置后的站点配置文件内容如下
- server {
- listen 80;
- listen 443 ssl;
- server_name dns.diledns.com;
- ssl_certificate /root/dns.diledns.com.crt;
- ssl_certificate_key /root/dns.diledns.com.key;
- root /www/web/diledns/public_html;
- index index.html index.php index.htm;
- error_page 400 /errpage/400.html;
- error_page 403 /errpage/403.html;
- error_page 404 /errpage/404.html;
- location ~ \.php$ {
- proxy_pass http://127.0.0.1:88;
- include naproxy.conf;
- }
- location / {
- try_files $uri @apache;
- }
- location @apache {
- proxy_pass http://127.0.0.1:88;
- include naproxy.conf;
- }
- }
复制代码
修改完成保存并重启nginx生效
|
|