此方法适用apache+nginx组合或者单独使用NGINX
WDCP创建了一个一个网站后会在/www/wdlinux/nginx/conf/vhost生成对应的网址.conf
先切换到目标目录= =
- cd /www/wdlinux/nginx/conf/vhost
- 或登陆WDCP后台http://你的IP:端口/sys/file?p=/www/wdlinux/nginx/conf/vhost&act=list&t=d
编辑相应网站的conf文件
默认的内容如下:
server { listen 80; root /www/web/chok/public_html; server_name chok.me www.chok.me; 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 ~ /\.ht { deny all; } location / { try_files $uri @apache; } location @apache { proxy_pass http://127.0.0.1:88; include naproxy.conf; } }
我们只需加入:
- listen 443 ssl;
- ssl_certificate /root/chok.crt;
- ssl_certificate_key /root/chok.key;
即可。【目录可以自定】
修改后内容如下
- server {
- listen 80;
- listen 443 ssl;
- server_name chok.me www.chok.me;
- ssl_certificate /root/chok.crt;
- ssl_certificate_key /root/chok.key;
- root /www/web/pma/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;
- error_page 405 /errpage/405.html;
- location ~ \.php$ {
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- include fcgi.conf;
- }
- }
然后保存并重启nginx
service nginxd restart