Method analysis of setting binding apache domain name under Lamp environment

  • 2020-10-07 18:58:01
  • OfStack

This article shows how to set up binding apache domain names in Lamp environment. To share for your reference, the details are as follows:

First go to the apache configuration directory


[root@iZ233vkrtsiZ local]# cd /usr/local/apache/conf/vhost

Then find the configuration of your site. Take this site for example


[root@iZ233vkrtsiZ vhost]# vim www.eyblog.com.conf
<VirtualHost *:80>
ServerAdmin webmaster@example.com
php_admin_value open_basedir "/home/wwwroot/www.eyblog.com:/tmp/:/var/tmp/:/proc/"
DocumentRoot "/home/wwwroot/www.eyblog.com"
ServerName www.eyblog.com ServerAlias eyblog.com
ErrorLog "/home/wwwlogs/www.eyblog.com-error_log"
CustomLog "/home/wwwlogs/www.eyblog.com-access_log" common
<Directory "/home/wwwroot/www.eyblog.com">
  SetOutputFilter DEFLATE
  Options FollowSymLinks
  AllowOverride All
  Order allow,deny
  Allow from all
  DirectoryIndex index.html index.php
</Directory>
</VirtualHost>

Just modify the corresponding parameters.


PidFile logs/httpd.pid # The first 1 a httpd process ( The parent of all other processes ) Process number file location. 
Listen 80 # The port number the server is listening to. 
ServerName www.eyblog.com:80 # The name of the primary site (the host name of the site). 
ServerAlias # Aliases, which can be multiple domains 
ServerAdmin admin@clusting.com # Administrator's email address. 
DocumentRoot "/mnt/web/clusting" # The web page storage location for the primary site. 

Options: Configure which features to use in a particular directory, common values and basic meanings are as follows:
ExecCGI: This directory allows the execution of CGI scripts.
FollowSymLinks: Allows file systems to use symbolic connections in this directory.
Indexes: When the user accesses this directory, if the user cannot find the home page file specified by DirectoryIndex (for example, index.html), the list of files in this directory is returned to the user.
SymLinksIfOwnerMatch: When using a symbolic link, it is only accessible if the file owner of the symbolic link is the same as the owner of the actual file.
AllowOverride: Type of instruction allowed to exist in.htaccess files (.htaccess filename can be changed and its filename is determined by the AccessFileName directive) :
None: When AllowOverride is set to None. Do not search for.htaccess files in this directory (to reduce server overhead).
All: All instructions can be used in the.htaccess file.
Order: Control which of the two access rules, Allow and Deny, takes precedence during access:
Allow: List of hosts allowed (domain name or subnet available, for example: Allow from 192.168.0.0/16).
Deny: List of hosts denied access.


<IfModule prefork.c>
StartServers 5 # Start the apache Start the httpd Number of processes. 
MinSpareServers 5 # Minimum number of idle processes held by the server. 
MaxSpareServers 10 # Maximum number of idle processes held by the server. 
MaxClients 150 # Maximum number of concurrent connections. 
MaxRequestsPerChild 1000 # How many times each child process is requested to be serviced before being served kill It off. 0 Indicates unrestricted, and is recommended as 1000 . 
</IfModule>

I hope this article has been helpful in setting up the Apache server in the Lamp environment.


Related articles: