In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of CentOS7.2 how to configure Apache service, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to configure Apache service in CentOS7.2. Let's take a look.
1. Perl + mod_perl
Install mod_perl to make perl scripts fast
[1] install mod_perl# install [root@linuxprobe ~] # yum from epel-- enablerepo=epel-y install mod_perl [2] configure perlrun mode, always put the perl interpreter on the ram. [root@linuxprobe ~] # vi / etc/httpd/conf.d/perl.conf# line 15: uncomment (check codes and output warnings to logs) perlswitches-w # line 24: uncomment perlswitches-t # line 30-36: uncomment alias / perl / var/www/perl # the directory for mod_perl environment sethandler perl-script # processes files as perl-scripts under this directory# addhandler perl-script .CGI # set specific extension if do do not want to processes All files as cgi# perlresponsehandler modperl::registry perlresponsehandler modperl::perlrun# specify perlrun mode perloptions + parseheaders options + execcgi# line 43-49: uncomment and add the following information: sethandler perl-script perlresponsehandler apache2::status require ip 127.0.0.1 10.1.1.1move 2pm add access permission# order deny Allow# deny from all# allow from .example.com [root@linuxprobe ~] # systemctl restart httpd [3] create a test script to ensure that the setting is not ploblem. If the results shown below are displayed, you can. [root@linuxprobe ~] # mkdir / var/www/perl [root@linuxprobe ~] # vi / varqqqxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx } [root@linuxprobe ~] # chmod 705 / var/www/perl/test-mod_perl.cgi # client browser access: http://linuxprobe.org/perl/test-mod_perl.cgi
[4] configure registry mode with code cache on ram
[root@linuxprobe ~] # vi / etc/httpd/conf.d/perl.confalias / perl / var/www/perl sethandler perl-script perlresponsehandler modperl::registry # uncomment# perlresponsehandler modperl::perlrun # comment out perloptions + parseheaders options + execcgi [root@linuxprobe ~] # systemctl restart httpd
[5] access the test script as an example in section [4], and then the variables are incremented by reloading because the variables are cached on the ram. So it is necessary to edit the registry mode code, where the browser is not refreshed once, the value of $a plus one.
[root@linuxprobe ~] # vi / varUniverse; sub number {my ($a) = @ _; $number\ $a = $a ";}
[6] by the way, you can see the status of mod_perl to access "http:// (hostname or ip address) / perl-status".
2. Php + php-fpm
Install php-fpm to make php scripts fast
[1] to install php, please refer to here. [2] install php-fpm. [root@linuxprobe ~] # yum-y install php-fpm [3] configure apache httpd. [root@linuxprobe ~] # vi / etc/httpd/conf.d/php.conf# line 5: change like follows# sethandler application/x-httpd-php sethandler "proxy:fcgi://127.0.0.1:9000" [root@linuxprobe ~] # systemctl start php-fpm [root@linuxprobe ~] # systemctl enable php-fpm [root@linuxprobe ~] # systemctl restart httpd [4] create phpinfo and access it, and then if "fpm / fastcgi" displays, it is OK. [root@linuxprobe ~] # echo'> / var/www/html/info.php
3. Python + mod_wsgi
Install mod_wsgi (wsgi:web Server Gateway Interface) to make python scripts faster
[1] install mod_wsgi. [root@linuxprobe ~] # yum-y install mod_wsgi [2] for example, configure mod_wsgi to access / test_wsgi The backend is / var/www/html/test_ wsgi.py.[ root @ linuxprobe ~] # vi / etc/httpd/conf.d/wsgi.conf# create newwsgiscriptalias / test_wsgi / var/www/html/test_ wsgi.py [root @ linuxprobe ~] # systemctl restart httpd [3] create the test script you set up above. [root@linuxprobe ~] # vi / var/www/html/test_wsgi.py# create newdef application (environ Start_response): status = '200ok' html ='\ n'\'\ n'\ 'mod_wsgi test page\ n'\'\ n' response_header = [('content-type','text/html')] start_response (status,response_header) return [html]
[4] configure if you use django. ([refer to install django] (http://blog.csdn.net/wh211212/article/details/52992413)) for example Configure "testapp" [root@linuxprobe ~] # vi / etc/httpd/conf.d/django.conf# create newwsgidaemonprocess testapp python-path=/home/wang/venv/testproject:/home/wang/venv/lib/python2.7/site-packageswsgiprocessgroup testappwsgiscriptalias / django / home/wang/venv/testproject/testproject/wsgi.py require all granted [root@linuxprobe ~] # systemctl restart httpd under "/ home/wang/venv/testproject" under "wang"
Access log analyzer: awstats
Install awstats, which reports http logs to analyze access to the http server.
[1] install awstats.
# install from epel [root@linuxprobe ~] # yum-- enablerepo=epel-y install awstats# awstats. (hostname) .conf is automatically generated [root@linuxprobe ~] # vi / etc/awstats/awstats.linuxprobe.org.conf# line 122: change# if your config for log format in httpd.conf is' combined' set here'1 # if log-config is' common' set here'4, but in this case Some informations can't be get (browser info and so on) logformat=1# line 153: specify your hostnamesitedomain= "linuxprobe.org# line 168: set ip address you'd like to excludehostaliases=" localhost 127.0.0.1 regex [server\ .world $] regex [^ 10\ .1\ .1\.] "[root@linuxprobe ~] # vi / etc/httpd/conf.d/awstats.conf# line 30: ip address you permit to accessrequire ip 10.1.1.0 ip address you permit to accessrequire ip 24 [root@linuxprobe ~] # systemctl restart httpd# generate Reports (reports are updated for hourly by cron) [root@linuxprobe ~] # / usr/share/awstats/linuxproberoot/cgi-bin/awstats.pl-config=linuxprobe.org-updatecreate/update database for config "/ etc/awstats/awstats.linuxprobe.org.conf" by awstats version 7.4 (build 20150714) from data in log file "/ var/log/httpd/access_log"... phase 1: first bypass old records Searching new record...searching new records from beginning of log file...phase 2: now process new records (flush history on disk after 20000 hosts)... jumped lines in file: 0parsed lines in file: 165found 0 dropped records, found 0 comments, found 0 blank records, found 0 corrupted records, found 0 old records, found 165new qualified records.
[2] visit "http:// (name of your server or ip address /) / awstats/awstats.pl", and then display the following screen to see the httpd log report.
This is the end of the article on "how to configure Apache Services for CentOS7.2". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to configure Apache services in CentOS7.2". If you want to learn more, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.