Apache httpd Services

Source: Internet
Author: User
Tags http post response code http strict transport security

Implementation of HTTPS

? 1) CA server side, generate self-signed certificate

[Email protected] ~]# cd/etc/pki/ca/07720483650Touch echo >  serial 

? 2) HTTP server side, generate signing request

mkdir /etc/httpd/conf.d/~]# cd/etc/httpd/conf.d/0771024x768- New-key Httpd.key-SCP192.168. 0.2:/etc/pki/ca/

? 3) CA server side, sign

[email protected] ca]# OpenSSL CA-in192.168SCP. 0.7:/etc/httpd/conf.d/ssl/

? 4) HTTP server side, configure HTTPS

ls -1yuminstall mod_ssl-~]# vim/etc/httpd/conf.d// etc/httpd/conf.d/ssl//etc/httpd/conf.d/ssl//etc/httpd/conf.d/ssl/cacert.pem

Test access: https://192.168.0.7 , import the root certificate to trust this site

? 5) Configure HTTP redirection to HTTPS, and forward HTTP requests to HTTPS URLs: two implementations, recommended use of HSTs

    • Redirect [status] Url-path URL This method is not appropriate and will be redirected repeatedly

    • Hsts:http Strict Transport Security

? After the server-side configuration supports HSTs, the HSTs field is carried in the HTTP header returned to the browser. Once the browser obtains this information, it will make all HTTP access requests internally 307 to HTTPS. Without any network process

The HSTS preload list in the HSTS preload List:chrome Browser is automatically converted to HTTPS when accessed by a Chrome browser in the list of sites. Firefox, Safari, Edge browser will also use this list

[[email protected] ~]# vim/etc/httpd/conf.d/myhttpd.confheader always set Strict"max-age= 31536000"^ (/.*) $  https://%{http_host}$1 [redirect=302]

Test access http:// will automatically jump tohttps://

Reverse proxy functionality for HTTP

Not recommended for use

Enable Reverse proxy:

    • Proxypass "/" "http://www.example.com/"
    • Proxypassreverse "/" "http://www.example.com/"

Specific URL reverse proxy:

    • Proxypass "/images" "http://www.example.com/"
    • Proxypassreverse "/images" "http://www.example.com/"
~]# vim/etc/httpd/conf.d/"/"  "http://192.168.0.7/  "/""http://192.168.0.7/"   
Web-related tools 1, Curl command

? Curl is a file transfer tool that works in command-line mode based on URL syntax, which supports protocols such as FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, file, and LDAP. Curl supports HTTPS authentication, and supports HTTP post, put and other methods, FTP upload, Kerberos authentication, HTTP upload, proxy server, cookies, username/password Authentication, download file breakpoint continuation, upload file breakpoint continuation, HTTP proxy Server pipeline (proxy tunneling), also supports IPV6,SOCKS5 proxy server, upload files via HTTP proxy server to FTP server, etc., the function is very powerful.

Usage: Curl [options][url ...]

Options:

    • -A string sets the user agent (browser) to send to the server
    • -e URL Camouflage Source Web site
    • --cacert file specifies the use of CA certificates
    • -K allows the certificate to be ignored for SSL connections
    • --compressed required to return a compressed format
    • -H Custom header information is passed to the server
    • -I display page content, including message header information
    • -I only displays the response message header information
    • -D file stores header information for URLs in specified files
    • --basic using HTTP Basic authentication
    • -U User:password set the user and password for the server
    • -L If there is a 3xx response code, re-send the request to a new location
    • -O Saves the file to a local by using the default file name in the URL
    • -o file to save network files in the specified file
    • --limit-rate Limiting transfer speed
    • -0 number 0, using http/1.0 protocol
    • -V Show More information
    • -C option to use a breakpoint for the file to continue the transfer function
    • -C Store The cookie in the URL in the specified file
    • -X Proxyhost:port Specify proxy server address
    • -X COMMAND sends the specified request method to the server
    • -U user:password Proxy Server user and password
    • The-t option uploads the specified local file to the FTP server
    • -D mode Specifies that data is passed using post
    • -B Name=data Gets the value from the server response Set-cookie and returns it to the server
2, HTPASSWD

Basic certification based on file implementation, the use of the account password file generation tool

Usage: htpasswd [options]/path/httpd_passwd_file username

    • -C: Automatically create files, should only be used when the file does not exist
    • -P: PlainText password
    • -d:crypt format encryption, default
    • -M:MD5 format Encryption
    • -s:sha format Encryption
    • -D: Delete the specified user
# Htpasswd-mc/etc/httpd/conf.d/.htuser Admin
3, Apachectl

HTTPD comes with a service control script that supports options such as Start, stop, and restart

4, Rotatelogs:

Log Scrolling Tool

5. AB command

httpd pressure test tool from Httpd-tools pack

Usage: AB [options] URL

    • -N: Total number of requests
    • -C: Analog concurrency number
    • -K: Tested in persistent connection mode

Apache httpd Services

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.