简体   繁体   English

在本地主机上使用SSL开发网站时需要考虑什么

[英]What do I need to consider when developing on the localhost a website with SSL

I'm new to php . 我是php的新手。 currently I'm developing my first website in my life. 目前,我正在开发自己的第一个网站。 I'm developing on my personal windows computer with XAMPP . 我正在使用XAMPP在个人Windows计算机上进行开发。 I'm planning to deploy the website on a Linux server with SSL certificate . 我打算将网站部署在具有SSL证书的Linux服务器上。

While the development stage I always keep in my mind that this code will work on Linux. 在开发阶段,我始终牢记此代码将在Linux上运行。 So I try to consider the differences between the 2 operating systems -according to my limited experience with Linux systems- . 因此,根据我对Linux系统的有限经验,我尝试考虑两种操作系统之间的差异。 for example in my code I replaced 例如在我替换的代码中

fwrite($handle,"a line of text\r\n");

with

fwrite($handle,"a line of text" . PHP_EOL);

and

$path = "c://xampp/htdocs/index.php";

with

$path = $_SERVER['DOCUMENT_ROOT'] ."index.php";

My question now. 我的问题了。 Is there any thing I need to consider about SSL certificate while developing in this environment ? 在这种环境下开发时,我需要考虑SSL证书吗?

Not really no, the SSL certificate is nothing to do with your php coding. 并非完全没有,SSL证书与您的php编码无关。 The only thing that i can think of that will create a nuisance in your website is linking none secure content. 我能想到的唯一会在您的网站中造成麻烦的是,没有链接任何安全内容。 EG a css file called with http instead of https. EG一个使用http而不是https的css文件。 you can solve that by simply calling scripts images and the like with just // to eliminate the protocol dependency. 您可以通过只用//调用脚本图像等来解决此问题,以消除协议依赖性。

By that i mean, //path/to/file or //example.com/path/to/script.js and so on. 我的意思是// path / to / file或//example.com/path/to/script.js等。 If calling over ssl any remote host must also support ssl although you will most likely be using a CDN witch generally do support it. 如果通过ssl调用,则任何远程主机也必须支持ssl,尽管您很可能会使用CDN巫婆,但通常会支持它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM