设为首页 收藏本站
查看: 773|回复: 0

[经验分享] How To Create a SSL Certificate on Apache for Debian 7 |htttps

[复制链接]

尚未签到

发表于 2018-11-20 10:10:20 | 显示全部楼层 |阅读模式
  Nov 11, 2013  Security, Apache Debian
Background Information
  A SSL certificate is a way to encrypt a site's information and createa more secure connection. While Certificate authorities can issue SSL
certificates that verify the server's details, a self-signed certificatehas no third party corroboration. This tutorial explains how to create aself-signed SSL certificate, add it to your VPS, and configure the SSL
file to display the certificate to the world.
1) Install Apache
  If Apache is not already running on your server, these is an Apache httpd package readily available for aptitude under the name apache2.
  Run the following command to install:
sudo apt-get install apache2  To test that the package was properly installed, enter your VPS IP
address into your browser. If the installation was successful, the
browser shall display the following:
It works!  

  
This is the default web page for this server.
  
The web server software is running but no content
  
has been added, yet.
2) Configure httpd
  We need to configure httpd in order to support SSL. It is available
in the httpd installation as a part of the apache2-common package.
  Use the following commands to enable SSL:
sudo a2ensite default-ssl  
sudo a2enmod ssl
  This time, as stated, let’s restart Apache2:
sudo service apache2 restart  To test that the module was properly installed, we are going to type
our IP address into the browser as before; however, this time we will
use https://. Follow this with your IP address in your browser.
  The first time you access the page, the browser will warn you that
the certificate of the site is not trusted. You can proceed and you willget to the same page as before:
It works!  

  
This is the default web page for this server.
  
The web server software is running but no content has been added,
  
yet.
3) Generate a Self-Signed Certificate
  To use a self-signed certificate, the package ssl-cert must be installed.
  I wanted to configure my own self-signed certificate for the server
and to store it in /etc/apache2/ssl. To do so, run the following
commands:
sudo mkdir /etc/apache2/ssl  When we request a new certificate,  we can specify how long the
certificate should remain valid by changing the 365 to the number of
days we prefer. As it stands this certificate will expire after one
year.
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt  With this command, we will be both creating the self-signed SSL
certificate and the server key that protects it, and placing both of
them into the new directory.
  This command will prompt terminal to display a lists of fields that need to be filled in.
  The most important line is "Common Name". Enter your official domain
name here or, if you don't have one yet, your site's IP address.
You are about to be asked to enter information that will be incorporated  
into your certificate request.
  
What you are about to enter is what is called a Distinguished Name or a DN.
  
There are quite a few fields but you can leave some blank
  
For some fields there will be a default value,
  
If you enter '.', the field will be left blank.
  
-----
  
Country Name (2 letter code) [AU]:US
  
State or Province Name (full name) [Some-State]:New York
  
Locality Name (eg, city) []:NYC
  
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Awesome Inc
  
Organizational Unit Name (eg, section) []:Dept of Merriment
  
Common Name (e.g. server FQDN or YOUR name) []:example.com      
  
Email Address []:webmaster@awesomeinc.com
4) Set Up the Certificate
  Now we have all of the required components of the finished
certificate.The next thing to do is to set up the virtual hosts to
display the new certificate.
  Open up the SSL config file:
nano /etc/apache2/sites-available/default-ssl  Within the section that begins with &ltVirtualHost default:443>, quickly make the following changes.
  Add a line with your server name right below the Server Admin email:
ServerName example.com:443  Replace example.com with your DNS approved domain name or server IP
address (it should be the same as the common name on the certificate).
  Find the following three lines, and make sure that they match the extensions below:
SSLEngine on  
SSLCertificateFile /etc/apache2/ssl/apache.crt
  
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
  Save and Exit out of the file.
5) Activate the New Virtual Host
  Before the website that will come on the 443 port can be activated, we need to enable that Virtual Host:
sudo a2ensite default
  You are all set. Restarting your Apache server will>sudo service apache2 reload  In your browser, type https://youraddress, and you will be able to see the new certificate.
See More
  Once you have setup your SSL certificate on the site, you can Install an FTP server if you haven't done so yet.
  By Adam LaGreca



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-637267-1-1.html 上篇帖子: How To Create a SSL Certificate on Apache for Debian 8 htttps 下篇帖子: Apache自签ssl证书
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表