主页

Apache和Nginx服务器配置证书

汝命一休矣   IP属地: 青海
0 点赞 0阅读 3060
Nginx证书配置
#80配置如下
server {
        listen        80;
        server_name  ceshi.jifengyinyue.com;
        root   "C:/Users/Administrator/Desktop/testmonsoont/public";
        location / {
            index index.php index.html error/index.html;
 if (!-e $request_filename) {
		        rewrite ^/(.*)$ /index.php/$1 last;
		        break;
	        }
            error_page 400 /error/400.html;
            error_page 403 /error/403.html;
            error_page 404 /error/404.html;
            error_page 500 /error/500.html;
            error_page 501 /error/501.html;
            error_page 502 /error/502.html;
            error_page 503 /error/503.html;
            error_page 504 /error/504.html;
            error_page 505 /error/505.html;
            error_page 506 /error/506.html;
            error_page 507 /error/507.html;
            error_page 509 /error/509.html;
            error_page 510 /error/510.html;
            include C:/Users/Administrator/Desktop/testmonsoont/public/nginx.htaccess;
            autoindex  off;
        }
        location ~ \.php(.*)$ {
            fastcgi_pass   127.0.0.1:9001;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }
}
#443证书配置如下(重点)
server {
	listen 443 ssl;
	server_name  ceshi.jifengyinyue.com;
	root   "C:/Users/Administrator/Desktop/testmonsoont/public";
	index index.html index.htm index.php;   ##主页类型
        #下面是配置证书得路径,一定要配置对
	ssl_certificate C:/Users/Administrator/Desktop/testmonsoont/4974055__jifengyinyue.com_nginx/4974055__jifengyinyue.com.pem;
    ssl_certificate_key C:/Users/Administrator/Desktop/testmonsoont/4974055__jifengyinyue.com_nginx/4974055__jifengyinyue.com.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 / {
	root   "C:/Users/Administrator/Desktop/testmonsoont/public";       ##网站根目录位置    
	index index.html index.htm index.php;         ##主页类型
	if (!-e $request_filename) {
		        rewrite ^/(.*)$ /index.php/$1 last;
		        break;
	        }
	}
	location ~ \.php(.*)$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO  $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
        include        fastcgi_params;
    }
}

Apache证书配置

<VirtualHost *:80>
    DocumentRoot "D:/phpstudy/WWW/www.china-bxzb.com"
    ServerName www.china-bxzb.com
    ServerAlias www.china-bxzb.cn
    FcgidInitialEnv PHPRC "D:/phpstudy/Extensions/php/php5.6.9nts"
    AddHandler fcgid-script .php
    FcgidWrapper "D:/phpstudy/Extensions/php/php5.6.9nts/php-cgi.exe" .php
  <Directory "D:/phpstudy/WWW/www.china-bxzb.com">
      Options FollowSymLinks ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
      Require all granted
	  DirectoryIndex index.php index.html
  </Directory>
  ErrorDocument 400 /error/400.html
  ErrorDocument 403 /error/403.html
  ErrorDocument 404 /error/404.html
  ErrorDocument 500 /error/500.html
  ErrorDocument 501 /error/501.html
  ErrorDocument 502 /error/502.html
  ErrorDocument 503 /error/503.html
  ErrorDocument 504 /error/504.html
  ErrorDocument 505 /error/505.html
  ErrorDocument 506 /error/506.html
  ErrorDocument 507 /error/507.html
  ErrorDocument 510 /error/510.html
</VirtualHost>

<VirtualHost *:443>
   DocumentRoot "D:/phpstudy/WWW/www.china-bxzb.com"
    ServerName www.china-bxzb.com
    ServerAlias www.china-bxzb.cn
    SSLEngine on
    SSLCertificateFile "D:/phpstudy/Extensions/Apache2.4.39/conf/ssl/5757640_china-bxzb.com_public.crt"
    SSLCertificateKeyFile "D:/phpstudy/Extensions/Apache2.4.39/conf/ssl/5757640_china-bxzb.com.key"
    SSLCertificateChainFile "D:/phpstudy/Extensions/Apache2.4.39/conf/ssl/5757640_china-bxzb.com_chain.crt"
    FcgidInitialEnv PHPRC "D:/phpstudy/Extensions/php/php5.6.9nts"
    AddHandler fcgid-script .php
    FcgidWrapper "D:/phpstudy/Extensions/php/php5.6.9nts/php-cgi.exe" .php
  <Directory "D:/phpstudy/WWW/www.china-bxzb.com">
      Options FollowSymLinks ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
      Require all granted
	  DirectoryIndex index.php index.html error/index.html
  </Directory>
  ErrorDocument 400 /error/400.html
  ErrorDocument 403 /error/403.html
  ErrorDocument 404 /error/404.html
  ErrorDocument 500 /error/500.html
  ErrorDocument 501 /error/501.html
  ErrorDocument 502 /error/502.html
  ErrorDocument 503 /error/503.html
  ErrorDocument 504 /error/504.html
  ErrorDocument 505 /error/505.html
  ErrorDocument 506 /error/506.html
  ErrorDocument 507 /error/507.html
  ErrorDocument 510 /error/510.html
</VirtualHost>





© 著作权归作者所有,转载或内容合作请联系作者