httpd-2.2 version Installation and configuration

Source: Internet
Author: User

I. httpd-2.2 version installation and configuration

1. Installing httpd-2.2.3

#yun-y Install httpd

2. View the files generated by the httpd installation

#rpm-QL httpd | Less

3. Start the service

#service httpd Start

4. Start-Up service automatically

#chkconfig--add httpd

#chkconfig--level 345 httpd on

5. Create a test page

#cd/var/www/html

#vim index.html

Configuration files for 6.HTTPD services

#cd/etc/httpd/conf/

#cp httpd.conf Httpd.conf.bak

7. Edit the configuration file

#vim httpd.conf

Servertokens Major

KeepAlive on

8. Modify the Web site root directory

DocumentRoot "/web/html"

<directory "/web/html" >

Options None

AllowOverride None

Order Deny,allow

Deny from 192.168.0.1 172.16.100.177

<Directory/>

9. Check if the configuration file is syntactically correct

#httpd-T

Use a plain text browser under 10.linux

#elinks HTTP://IP

11. Restrict user access to the site

AllowOverride authconfig

AuthType Basic

AuthName "Restricted Files"

AuthUserFile "/ETC/HTTPD/CONF/HTPASSWD"

Require valid-user or Require user Hadoop

12. Set up user-defined files

# htpasswd-c-M/ETC/HTTPD/CONF/HTPASSWD Hadoop

# htpasswd-m/ETC/HTTPD/CONF/HTPASSWD Tom

13. Restart the service

#service httpd Restart

14. Test the setup success on your computer browser (limit users)

15. Group-qualified Access

AllowOverride authconfig

AuthType Basic

AuthName "Restricted Files"

AuthUserFile "/ETC/HTTPD/CONF/HTPASSWD"

AuthGroupFile "/etc/httpd/conf/htgroup"

Require Group Myusers

16. Create a user group file

#vim/etc/httpd/conf/htgroup

Myusers:hadoop Tom

17. Restart the service

#service httpd Restart

18.htpasswd command to delete a user

#htpasswd-D Hadoop

19. Configuration of the virtual host

First, note the hub host DocumentRoot

20. Create a virtual machine configuration file in the/etc/httpd/conf.d/directory

#vim/etc/httpd/conf.d/virtual.conf

Namevirtualhost 172.16.100.1:80

<virtualhost 172.16.100.1:80〉

ServerName www.luochen.com

DocumentRoot "/web/luochen"

Customlog/var/log/httpd/luochen/access_log combined

<directory "/web/luochen" >

Options None

AllowOverride authconfig

AuthType Basic

AuthName "Restricted Files"

AuthUserFile "/ETC/HTTPD/CONF/HTPASSWD"

Require valid-user or Require user Hadoop

<Directory/>

</VirtualHost>


<virtualhost 172.16.100.1:80〉

ServerName www.luo.com

DocumentRoot "/web/luo"

Customlog/var/log/httpd/luo/access_log combined

<directory "/web/luo" >

Options None

AllowOverride None

Order Deny,allow

Deny from 192.168.0.1 172.16.100.177

<Directory/>

</VirtualHost>

21. Edit the Hosts file under Windows

172.16.100.1 www.luochen.com

172.16.100.1 www.luo.com

22. Install the Mod_ssl module (HTPPD based on RPM package installation)

#yum-y Install Mod_ssl

23. View Mod_ssl installation to generate those files

#rpm-QL Mod_ssl

24. Self-built CA (on 172.16.100.10 host)

#cd/etc/pki/ca

# (Umask 077; OpenSSL genrsa-out PRIVATE/CAKEY.PEM 2048;)

#vim/etc/pki/tls/openssl.cnf

[Req_distinguished_name]

Countryname_default = CN

Setorprovincename_default = HB

Localityname_default = WUHAN

0.organizationname_default = COLLEGE

Organizationalunitname_default = Tech

25.openssl Req-new-x509-key private/cakey.pem-out cacert.pem-days 3650

Hostname ca.luochen.com

26. Edit the OpenSSL file

DIR =/etc/pki/ca

27. Create the appropriate catalog file

#mkdir certs Newcerts CRL

#touch Index.txt

#echo > Serial

28. Create the SSL directory under the HTTPD Service directory (on the 172.16.100.1 host)

#mkdir/etc/httpd/ssl

# (Umask 077; OpenSSL genrsa 2048 > Httpd.key)//Generate key

#openssl req-new-key httpd.key-out HTTPD.CSR//Generate certificate issuance request

hostname = = = ServerName

#scp HTTP.CSR 172.16.100.10:/tmp//Copy the certificate issuance request to the server side

29. On the 172.16.100.10 host

#openssl Ca-in/tmp/httpd.csr-out/tmp/httpd.crt-daya 3650//Generate Certificate

#cat/etc/pki/ca/serial//show 02 is successful

30. Copy the certificate to the client host (172.16.100.1)

#scp 172.16.100.10/TMP/HTTPD.CRT.///Copy the certificate to the client host

31. Delete all files in the TMP directory

#vim RM-RF./*

32. Edit the/etc/httpd/conf.d/ssl.conf file (172.16.100.1)

#vim/etc/httpd/conf.d/ssl.conf

<virtualhost 172.16.100.1:443>

ServerName www.luochen.com

DocumentRoot "/web/www/luochen"

Sslcertificatefile/etc/httpd/ssl/httpd.crt

Sslcertificatekeyfile/etc/httpd/ssl/httpd.key

</VirtualHost>

33. Restart the HTTPD server

#service httpd Restart

34. Copy the CA's certificate to the Windows host

/ETC/PKI/CA/CACERT.PEM//In 172.16.100.10

35. Renaming a certificate on a Windows host

Cacert.pem CACERT.CRT

36. Double-click Install certificate

37. Finally access authentication with HTTPS protocol in the browser


This article is from "Luo Chen's blog" blog, please be sure to keep this source http://luochen2015.blog.51cto.com/9772274/1694457

httpd-2.2 version Installation and configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.