Article Title: Apache installation, configuration, and optimization. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Apache installation, configuration, and optimization
Install Apache 2.0.48 (view the Install manual)
Considering that rewite_url is required in the future to make it easier for google to include websites, mod_rewrite is specially added.
In addition, the mod_limitpcnn.c patch is added to restrict traffic. Therefore, the -- enable-forward option is added.
We recommend that you do not delete the installation directory after the installation is complete for later upgrade.
Remember to disable apache2.0 before Upgrade
Compilation process:
Code:
#./Configure -- enable-so -- enable-speling -- enable-rewrite -- with-ssl =/usr/local/ssl -- enable-forward # Make # Make install |
In this example, mod_so, mod_speling, and openssl support are compiled.
There are also several other writing methods
Code:
#./Configure -- enable-modules = so -- enable-modules = speling -- enable-modules = rewrite |
Or
Code:
#./Configure -- enable-modules = "so speling" |
-- Enable-MODULE [= shared]: Compile and include the MODULE. module is the MODULE name for removing "_ MODULE" from the document. To compile a module into DSO, you need to add the-shared option, that is, -- enable-mod-shared. (View MODULE manual)
Note: "If you want the core to load DSO without actually compiling any dynamic modules, you must specify -- enable-modules = so or -- enable-so" (view DSO Manual ), therefore, the order above cannot be exchanged. View All apache configure Parameters
After installation, run the following command to view the modules that have been started:
Code:
# Apachectl-l Compiled in modules: Core. c Mod_access.c Mod_auth.c Mod_include.c Mod_log_config.c Mod_env.c Mod_setenvif.c Prefork. c Http_core.c Mod_mime.c Mod_status.c Mod_autoindex.c Mod_asis.c Mod_cgi.c Mod_negotiation.c Mod_dir.c mod_imap.c Mod_actions.c Mod_speling.c Mod_userdir.c Mod_alias.c Mod_rewrite.c Mod_so.c |
Then, put the startup program into the boot program. To enable the ssl encrypted Web page, you must manually start apache2.0 (see ssl section)
Code:
# Echo "/usr/local/apache2/bin/apachectl start">/etc/rc. d/rc. local |
Refer:
Code:
If you want your server to continue running after a system reboot, You shoshould add a call to apachectl to your system startup files (typically rc. local or A file in an rc. N directory). This will start Apache as root. Before doing this ensure That your server is properly configured for security and access restrictions. |
Add the preceding statements to the profile to set the path, which makes it easier to control apachectl in bash, saving the trouble of inputting the path.
Code:
# Vi/etc/profile PATH = "$ PATH: usr/local/apache2/bin :" |
Configure apache2.0
Code:
# Vi/usr/local/apache2/conf/httpd. conf |
For the configuration file, see httpd. conf (set the file directory to/home/dalouis/public_html)
Code:
# Chmod 755? R/home/dalouis/ |
Set the readability of the directory to drwxr-xr-x (755). Otherwise, "Forbidden You don't have permission to access/on this server will appear ."
Some security configurations:
Considering the security of cgi-bin, We will temporarily remove cgi-bin. Add #.
Xiyang Configuration
I used: Export, mod_expires, mod_gzip, mod_php4, mod_so, mod_access, mod_alias, mod_userdir, mod_dir, mod_autoindex, mod_status, mod_mime, mod_log_config, http_core
[1] [2] Next page