{"id":41011,"date":"2023-02-20T17:57:37","date_gmt":"2023-02-20T09:57:37","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=41011"},"modified":"2023-02-20T17:57:37","modified_gmt":"2023-02-20T09:57:37","slug":"view-apache-module-normal","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/view-apache-module-normal.html","title":{"rendered":"\u5982\u4f55\u67e5\u770b Apache \u6a21\u5757\u662f\u5426\u6b63\u5e38"},"content":{"rendered":"

\u672c\u7bc7\u4e2d\uff0c\u6211\u4eec\u4f1a\u7b80\u8981\u5730\u8ba8\u8bba Apache \u670d\u52a1\u5668\u524d\u7aef\u4ee5\u53ca\u5982\u4f55\u5217\u51fa\u6216\u67e5\u770b\u5df2\u7ecf\u542f\u7528\u7684 Apache \u6a21\u5757\u3002Apache \u57fa\u4e8e\u6a21\u5757\u5316\u7684\u7406\u5ff5\u800c\u6784\u5efa\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u8ba9 web \u7ba1\u7406\u5458\u6dfb\u52a0\u4e0d\u540c\u7684\u6a21\u5757\u6765\u6269\u5c55\u4e3b\u8981\u7684\u529f\u80fd\u53ca\u589e\u5f3a\u6027\u80fd\u3002
\n\u5e38\u89c1\u7684 Apache \u6a21\u5757\u6709\uff1a<\/p>\n

    \n
  1. mod_ssl\u00a0\u2013 \u63d0\u4f9b\u4e86 HTTPS \u529f\u80fd\u3002<\/li>\n
  2. mod_rewrite\u00a0\u2013 \u53ef\u4ee5\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d url \u6837\u5f0f\uff0c\u5e76\u4e14\u4f7f\u7528 .<\/a>htaccess \u6280\u5de7\u6765\u8fdb\u884c\u900f\u660e\u8f6c\u53d1\uff0c\u6216\u8005\u63d0\u4f9b HTTP \u72b6\u6001\u7801\u56de\u5e94\u3002<\/li>\n
  3. mod_security\u00a0\u2013 \u7528\u4e8e\u4fdd\u62a4 Apache \u514d\u4e8e\u66b4\u529b\u7834\u89e3\u6216\u8005 DDoS \u653b\u51fb\u3002<\/li>\n
  4. mod_status - \u7528\u4e8e\u76d1\u6d4b Apache \u7684\u8d1f\u8f7d\u53ca\u9875\u9762\u7edf\u8ba1\u3002<\/li>\n<\/ol>\n

    \"apache-logo\"
    \n\u5728 Linux \u4e2d apachectl \u00a0\u6216\u8005 \u00a0apache2ctl \u7528\u4e8e\u63a7\u5236 Apache \u670d\u52a1\u5668\uff0c\u662f Apache \u7684\u524d\u7aef\u3002<\/p>\n

    \u4f60\u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u663e\u793a apache2ctl \u7684\u4f7f\u7528\u4fe1\u606f\uff1a<\/p>\n

    $ apache2ctl help\r\n\u6216\u8005\r\n$ apachectl help\r\n<\/pre>\n
    Usage: \/usr\/sbin\/httpd [-D name] [-d directory] [-f file]\r\n                       [-C \"directive\"] [-c \"directive\"]\r\n                       [-k start|restart|graceful|graceful-stop|stop]\r\n                       [-v] [-V] [-h] [-l] [-L] [-t] [-S]\r\nOptions:\r\n  -D name            : define a name for use in  directives\r\n  -d directory       : specify an alternate initial ServerRoot\r\n  -f file            : specify an alternate ServerConfigFile\r\n  -C \"directive\"     : process directive before reading config files\r\n  -c \"directive\"     : process directive after reading config files\r\n  -e level           : show startup errors of level (see LogLevel)\r\n  -E file            : log startup errors to file\r\n  -v                 : show version number\r\n  -V                 : show compile settings\r\n  -h                 : list available command line options (this page)\r\n  -l                 : list compiled in modules\r\n  -L                 : list available configuration directives\r\n  -t -D DUMP_VHOSTS  : show parsed settings (currently only vhost settings)\r\n  -S                 : a synonym for -t -D DUMP_VHOSTS\r\n  -t -D DUMP_MODULES : show all loaded modules \r\n  -M                 : a synonym for -t -D DUMP_MODULES\r\n  -t                 : run syntax check for config files\r\n<\/pre>\n

    apache2ctl \u53ef\u4ee5\u5de5\u4f5c\u5728\u4e24\u79cd\u6a21\u5f0f\u4e0b\uff0cSysV init \u6a21\u5f0f\u548c\u76f4\u901a\u6a21\u5f0f\u3002\u5728 SysV init \u6a21\u5f0f\u4e0b\uff0capache2ctl \u7528\u5982\u4e0b\u7684\u7b80\u5355\u7684\u5355\u547d\u4ee4\u5f62\u5f0f\uff1a<\/p>\n

    $ apachectl command\r\n\u6216\u8005\r\n$ apache2ctl command\r\n<\/pre>\n

    \u6bd4\u5982\u8981\u542f\u52a8\u5e76\u68c0\u67e5\u5b83\u7684\u72b6\u6001\uff0c\u8fd0\u884c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u3002\u5982\u679c\u4f60\u662f\u666e\u901a\u7528\u6237\uff0c\u4f7f\u7528 sudo \u547d\u4ee4\u6765\u4ee5 root \u7528\u6237\u6743\u9650\u6765\u8fd0\u884c\uff1a<\/p>\n

    $ sudo apache2ctl start\r\n$ sudo apache2ctl status\r\n<\/pre>\n
    tecmint@TecMint ~ $ sudo apache2ctl start\r\nAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1\/. Set the 'ServerName' directive globally to suppress this message\r\nhttpd (pid 1456) already running\r\ntecmint@TecMint ~ $ sudo apache2ctl status\r\nApache Server Status for localhost (via 127.0.0.1)\r\n\r\nServer Version: Apache\/2.4.18 (Ubuntu)\r\nServer MPM: prefork\r\nServer Built: 2016-07-14T12:32:26\r\n\r\n-------------------------------------------------------------------------------\r\n\r\nCurrent Time: Tuesday, 15-Nov-2016 11:47:28 IST\r\nRestart Time: Tuesday, 15-Nov-2016 10:21:46 IST\r\nParent Server Config. Generation: 2\r\nParent Server MPM Generation: 1\r\nServer uptime: 1 hour 25 minutes 41 seconds\r\nServer load: 0.97 0.94 0.77\r\nTotal accesses: 2 - Total Traffic: 3 kB\r\nCPU Usage: u0 s0 cu0 cs0\r\n.000389 requests\/sec - 0 B\/second - 1536 B\/request\r\n1 requests currently being processed, 4 idle workers\r\n\r\n__W__...........................................................\r\n................................................................\r\n......................\r\n\r\nScoreboard Key:\r\n\"_\" Waiting for Connection, \"S\" Starting up, \"R\" Reading Request,\r\n\"W\" Sending Reply, \"K\" Keepalive (read), \"D\" DNS Lookup,\r\n\"C\" Closing connection, \"L\" Logging, \"G\" Gracefully finishing,\r\n\"I\" Idle cleanup of worker, \".\" Open slot with no current process\r\n<\/pre>\n

    \u5f53\u5728\u76f4\u901a\u6a21\u5f0f\u4e0b\uff0capache2ctl \u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u8bed\u6cd5\u5e26\u4e0a\u6240\u6709 Apache \u7684\u53c2\u6570\uff1a<\/p>\n

    $ apachectl [apache-argument]\r\n$ apache2ctl [apache-argument]\r\n<\/pre>\n

    \u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u5217\u51fa\u6240\u6709\u7684 Apache \u53c2\u6570\uff1a<\/p>\n

    $ apache2 help    [\u5728\u57fa\u4e8eDebian\u7684\u7cfb\u7edf\u4e2d]\r\n$ httpd help      [\u5728RHEL\u7684\u7cfb\u7edf\u4e2d]\r\n<\/pre>\n

    \u56e0\u6b64\uff0c\u4e3a\u4e86\u68c0\u6d4b\u4f60\u7684 Apache \u670d\u52a1\u5668\u542f\u52a8\u4e86\u54ea\u4e9b\u6a21\u5757\uff0c\u5728\u4f60\u7684\u53d1\u884c\u7248\u4e2d\u8fd0\u884c\u9002\u5f53\u7684\u547d\u4ee4\uff0c-t -D DUMP_MODULES \u662f\u4e00\u4e2a\u7528\u4e8e\u663e\u793a\u6240\u6709\u542f\u7528\u7684\u6a21\u5757\u7684 Apache \u53c2\u6570\uff1a<\/p>\n

    ---------------  \u5728\u57fa\u4e8e Debian \u7684\u7cfb\u7edf\u4e2d --------------- \r\n$ apache2ctl -t -D DUMP_MODULES   \r\n\u6216\u8005 \r\n$ apache2ctl -M\r\n<\/pre>\n
    ---------------  \u5728 RHEL \u7684\u7cfb\u7edf\u4e2d --------------- \r\n$ apachectl -t -D DUMP_MODULES   \r\n\u6216\u8005 \r\n$ httpd -M\r\n$ apache2ctl -M\r\n<\/pre>\n
    [root@tecmint httpd]# apachectl -M\r\nLoaded Modules:\r\n core_module (static)\r\n mpm_prefork_module (static)\r\n http_module (static)\r\n so_module (static)\r\n auth_basic_module (shared)\r\n auth_digest_module (shared)\r\n authn_file_module (shared)\r\n authn_alias_module (shared)\r\n authn_anon_module (shared)\r\n authn_dbm_module (shared)\r\n authn_default_module (shared)\r\n authz_host_module (shared)\r\n authz_user_module (shared)\r\n authz_owner_module (shared)\r\n authz_groupfile_module (shared)\r\n authz_dbm_module (shared)\r\n authz_default_module (shared)\r\n ldap_module (shared)\r\n authnz_ldap_module (shared)\r\n include_module (shared)\r\n....\r\n<\/pre>\n

    \u5c31\u662f\u8fd9\u6837\uff01\u5728\u8fd9\u7bc7\u7b80\u5355\u7684\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u89e3\u91ca\u4e86\u5982\u4f55\u4f7f\u7528 Apache \u524d\u7aef\u5de5\u5177\u6765\u5217\u51fa\u542f\u52a8\u7684 Apache \u6a21\u5757\u3002<\/p>\n

    \n

    \u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-7975-1.html<\/a><\/p>\n

    \u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/view-apache-module-normal.html<\/a>\u7f16\u8f91\u5458\uff1a\u51af\u632f\u534e\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

    \u672c\u7bc7\u4e2d\uff0c\u6211\u4eec\u4f1a\u7b80\u8981\u5730\u8ba8\u8bba Apache \u670d\u52a1\u5668\u524d\u7aef\u4ee5\u53ca\u5982\u4f55\u5217\u51fa\u6216\u67e5\u770b\u5df2\u7ecf\u542f\u7528\u7684 Apache \u6a21\u5757\u3002<\/p>\n","protected":false},"author":63,"featured_media":41039,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-41011","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/41011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=41011"}],"version-history":[{"count":13,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/41011\/revisions"}],"predecessor-version":[{"id":264822,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/41011\/revisions\/264822"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/41039"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=41011"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=41011"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=41011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}