Apache user authenticationOpen the site directly pop-up user name password, correct before you can view the site, this is called Apache user authentication.Edit the configuration file (because we are using Apache virtual host, so we enter the configuration of the virtual host)vim /usr/local/apache2.4/conf/extra/httpd-vhosts.confAdd the following paragraph to the
User authentication for Apachevim/usr/local/apache2.4/conf/extra/httpd-vhosts.conf//The 111.com virtual host is edited into the following contentDocumentRoot "/data/wwwroot/111.com"ServerName 111.comServeralias www.example.comAllowOverride authconfigAuthName "111.com User auth"AuthType Basicauthuserfile/data/.htpasswdRequire Valid-userErrorlog "Logs/111.com-error_log"Customlog "Logs/111.com-access_log" commonApache Authentication for individual filesvim/usr/local/apache2.4/conf/extra/httpd-vhost
Preface: Python statistics Apache, nginx access log IP access number and sort (show Top 20). In fact, with Awk+sort and other commands can be implemented, with the awk array can also be implemented, here is just a python try.Apache Script:IPS = {}with open ("/root/mail_access_log-20180629") as Fh:for line in Fh:ip = Li
Configure Apache access logs and log cuts1. Open the Apache master configuration file, command:vim/usr/local/apache2/conf/httpd.conf, locate the Log_config_module module, You can see two logformat(log format) as shown in:650) this.width=650; "Src=" https://s3.51cto.com/wyfs0
/apachectl -M |grep rewrite rewrite_module (shared)[[emailprotected] ~]# /usr/local/apache2.4/bin/apachectl graceful3. Test whether the jump was successful80 ports with a few colons is the start of several network cardscurl-x192.168.122.1:80 Www.example.com-I//-i can view results directly[[emailprotected] ~]# curl -x192.168.122.1:80 www.example.com -IHTTP/1.1 301 Moved PermanentlyDate: Wed, 07 Mar 2018 13:43:47 GMTServer: Apache/2.4.29 (Unix) PHP/7.1.
Apache, the browser access www.abc.com will jump directly to www.123.com.If you want to test the effect quickly, you can actually use the Curl command directly on the Linux command line.#curl-x127.0.0.1:80 Www.123.com/bbs/forum.php-Ihttp/1.1 301 Moved Permanentlyserver:nginx/1.0.15Connection:keep-aliveDate:thu, 14:12:56 GMTContent-type:text/htmlcontent-length:185location:http://www.123.com/bbs/forum.phpx-u
One, access log informationWhen the browser requests the server, if the access log is set on the server, the user's access record is logged.For example, I access a default log generated
/usr/local/apache2/bin/apachectl-m: See which modules are installed/usr/local/apache/bin/apachectl-v: Viewing the mode used/usr/local/apache2/bin/apachectl-t: Checking for syntax errors/usr/local/apache2/bin/apachectl-l: Viewing the installed library files/usr/local/apache2/bin/apachectl Graceful: Reload configuration/usr/local/apache2/htcocs Home Store Directory/usr/local/apache2/bin/apachectl Startup file directory/usr/local/apache2/conf configurati
and other types. ? ? ? 5) using the awstats_updateall.pl script provided by the Awstats system, you can update the log statistics for all sites, and when the script is executed, the new log content is automatically parsed and the analysis results updated to the statistics database. ? You can also set cron scheduled tasks so that the system periodically updates the l
; combinedCustomLog "|/usr/local/cronolog/sbin/cronolog/usr/local/apache-2.2.15/logs/referer_log" RefererCustomLog "|/usr/local/cronolog/sbin/cronolog/usr/local/apache-2.2.15/logs/agent_log" Agent# CustomLog "logs/access_log" combined Configuration method in Windows: The code is as follows:Copy code ErrorLog "| bin/rotatelogs.exe logs/site1/error-% y % m % d.
, delete rewrite_module (shared) in front of the #2. TestCurl-x127.0.0.1:80-i 123.com-i//Status code is 301Third, Apache access log1. Access logging records every request from a user2. Define the format for the logvim/usr/local/apache/conf/httpd.conf//Search for Logformat, it gives you two formats:Logformat "%h%l%u%t \
Linux System Configuration methods:
Change it to
The code is as follows
ErrorLog "| /usr/local/apache/bin/rotatelogs/home/logs/www/%y_%m_%d_error_log 86400 480″Customlog "| /usr/local/apache/bin/rotatelogs/home/logs/www/%y_%m_%d_access_log 86400 480″common
# # This is the log log
example of the www.linuxtestbak.com domain to jump to linuxtest.com :Step 1: Modify the virtual host configuration fileStep 2: Modify the httpd.conf file[[emailprotected] ~]# vim /usr/local/apache2/conf/httpd.confLoadModule rewrite_module modules/mod_rewrite.so //去掉#,以启用这个模块Step 3: Test[[emailprotected] ~]# curl -x 192.168.204.128:80 www.linuxtestbak.com -IHTTP/1.1 301 Moved PermanentlyDate: Fri, 02 Mar 2018 10:53:51 GMTServer: Apache/2.4.29 (Uni
1. Define the log format in the master configuration file[Email protected] ~]# vim/usr/local/apache2/conf/httpd.conf# Default defined log format, combined is the log format name logformat "%h%l%u%t \"%r\ "%>s%b" common # Default defined log format, C Ommon is a
Each user access generates an access log, along with an error log.So, the log files will accumulate over the long-range, early to explode our hard drive, so we can cut through the log, such as the number of days to cut into a series of documents. You can then delete a long f
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.