|
如果要在服务器新增一个虚拟主机,二级域名为app.13cloud.cn 1.到/alidata/server/nginx/conf/vhosts/目录下 2.复制cp 13cloud.cn.conf app.13cloud.cn.conf 3.打开app.13cloud.cn.conf并且编辑(i),最后保存(wq!) - server {
- listen 80;
- server_name app.13cloud.cn; //二级域名的名字
- index index.html index.htm index.php;
- root /alidata/www/app.13cloud.cn; //虚拟主机的目录(这一步还未创建此目录)
-
- location ~ .*\.(php|php5)?$
- {
- #fastcgi_pass unix:/tmp/php-cgi.sock;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- include fastcgi.conf;
- }
-
- location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
- {
- expires 30d;
- }
-
- location ~ .*\.(js|css)?$
- {
- expires 1h;
- }
-
- include /alidata/server/nginx/conf/rewrite/wordpress.conf; //加载主流框架伪静态规则
- }
复制代码4.创建虚拟主机目录mkdir /alidata/www/app.13cloud.cn(之后可以向此目录下上传程序)可以现在此目录下创建一个index.html占位 5.给此目录赋予www权限chown -R www:www app.13cloud.cn/ 6.重启 nginx 服务器 /etc/init.d/nginx reload
=====================================================
下面是配置https,配置完不要忘记6.重启 nginx 服务器 /etc/init.d/nginx reload
- server {
- listen 80;
- listen 443 ssl;
- #listen 443;
- server_name xxx.abc.net;
- index index.html index.htm index.php;
- root /alidata/www/xxx.abc.net;
- #下面是为了支持https
- ssl on;
- ssl_certificate cert/xxx.pem;
- ssl_certificate_key cert/xxx.key;
- ssl_session_timeout 5m;
- ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
- ssl_prefer_server_ciphers on;
- location ~ .*\.(php|php5)?$
- {
- #fastcgi_pass unix:/tmp/php-cgi.sock;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- include fastcgi.conf;
- }
- location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
- {
- expires 30d;
- }
- location ~ .*\.(js|css)?$
- {
- expires 1h;
- }
- #α¾²Ì¬¹æÔò
- #include /alidata/server/nginx/conf/rewrite/phpwind.conf;
- access_log /alidata/log/nginx/access/wechat.log;
- }
复制代码
|