Linux version RHEL7.0
IP address 172.7.16.111
Apache Service package named httpd, check Package
Using the Yum source installation package,
Configure the Yum method to refer to my blog, "Linux Yum Source Configuration method" http://blog.itpub.net/27771627/viewspace-1223153/
[Email protected] ~]# yum-y install httpd
Loaded plugins:langpacks, Product-id, Subscription-manager
This system isn't registered to Red Hat Subscription Management. You can use the Subscription-manager to register.
Testyum | 4.1 KB 00:00:00
Resolving Dependencies
--Running Transaction check
---> Package httpd.x86_64 0:2.4.6-17.el7 'll be installed
--Processing Dependency:httpd-tools = 2.4.6-17.el7 for package:httpd-2.4.6-17.el7.x86_64
-Processing Dependency:/etc/mime.types for package:httpd-2.4.6-17.el7.x86_64
--processing dependency:libapr-1.so.0 () (64bit) for package:httpd-2.4.6-17.el7.x86_64
--processing dependency:libaprutil-1.so.0 () (64bit) for package:httpd-2.4.6-17.el7.x86_64
--Running Transaction check
---> Package apr.x86_64 0:1.4.8-3.el7 'll be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 'll be installed
---> Package httpd-tools.x86_64 0:2.4.6-17.el7 'll be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 'll be installed
--Finished Dependency Resolution
Dependencies resolved
=============================================================================================================== ===
Package Arch Version Repository Size
=============================================================================================================== ===
Installing:
httpd x86_64 2.4.6-17.el7 Testyum 1.2 M
Installing for dependencies:
Apr x86_64 1.4.8-3.el7 Testyum 103 k
Apr-util x86_64 1.5.2-6.el7 Testyum k
Httpd-tools x86_64 2.4.6-17.el7 Testyum-K
Mailcap Noarch 2.1.41-2.el7 Testyum k
Transaction Summary
=============================================================================================================== ===
Install 1 package (+4 Dependent packages)
Total Download size:1.5 M
Installed size:4.3 M
Downloading packages:
--------------------------------------------------------------------------------------------------------------- ---
Total 4.3 mb/s | 1.5 MB 00:00:00
Running transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing:apr-1.4.8-3.el7.x86_64 1/5
Installing:apr-util-1.5.2-6.el7.x86_64 2/5
Installing:httpd-tools-2.4.6-17.el7.x86_64 3/5
Installing:mailcap-2.1.41-2.el7.noarch 4/5
Installing:httpd-2.4.6-17.el7.x86_64 5/5
Verifying:mailcap-2.1.41-2.el7.noarch 1/5
Verifying:httpd-tools-2.4.6-17.el7.x86_64 2/5
Verifying:apr-1.4.8-3.el7.x86_64 3/5
Verifying:apr-util-1.5.2-6.el7.x86_64 4/5
Verifying:httpd-2.4.6-17.el7.x86_64 5/5
Installed:
Httpd.x86_64 0:2.4.6-17.EL7
Dependency installed:
apr.x86_64 0:1.4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 httpd-tools.x86_64 0:2.4.6-17.el7
Mailcap.noarch 0:2.1.41-2.EL7
complete!
View configuration Files
The file that needs to be configured is/etc/httpd/conf/httpd.conf
View the configuration file, filter the following fields, the default home page path is the following
The default home page is named index.html
Go to the Home page path and create a test page
Restart HTTPD Service
Set up boot from
Set up the firewall so that the HTTP service can pass through the firewall
Restarting the firewall
Native test HTTP service configuration succeeded
Windows client browser tested successfully
Now that the Apache service has been configured successfully, continue to configure directory sharing
Create a shared directory and put the shared files inside
Editing a configuration file/etc/httpd/conf.d/autoindex.conf
Add the following configuration content
Alias/share "/liuzhenshare"
<directory "=" "liuzhenshare" = "" >
Options Indexes multiviews FollowSymLinks
AllowOverride None
Require all granted
After modifying the configuration file, restart the service
Install the Elink package in the server native test
[Email protected] liuzhenshare]# yum-y install ELinks
Loaded plugins:langpacks, Product-id, Subscription-manager
This system isn't registered to Red Hat Subscription Management. You can use the Subscription-manager to register.
Resolving Dependencies
--Running Transaction check
---> Package elinks.x86_64 0:0.12-0.36.pre6.el7 'll be installed
--processing dependency:libnss_compat_ossl.so.0 () (64bit) for package:elinks-0.12-0.36.pre6.el7.x86_64
--Running Transaction check
---> Package nss_compat_ossl.x86_64 0:0.9.6-8.el7 'll be installed
--Finished Dependency Resolution
Dependencies resolved
=============================================================================================================== ===
Package Arch Version Repository Size
=============================================================================================================== ===
Installing:
ELinks x86_64 0.12-0.36.pre6.el7 Testyum 882 k
Installing for dependencies:
Nss_compat_ossl x86_64 0.9.6-8.el7 Testyum Notoginseng k
Transaction Summary
=============================================================================================================== ===
Install 1 Package (+1 Dependent package)
Total Download size:919 k
Installed size:2.7 M
Downloading packages:
--------------------------------------------------------------------------------------------------------------- ---
Total 2.5 mb/s | 919 KB 00:00:00
Running transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing:nss_compat_ossl-0.9.6-8.el7.x86_64 1/2
Installing:elinks-0.12-0.36.pre6.el7.x86_64 2/2
Verifying:elinks-0.12-0.36.pre6.el7.x86_64 1/2
Verifying:nss_compat_ossl-0.9.6-8.el7.x86_64 2/2
Installed:
Elinks.x86_64 0:0.12-0.36.PRE6.EL7
Dependency installed:
Nss_compat_ossl.x86_64 0:0.9.6-8.EL7
complete!
Perform the following command server-side native test
Files that appear share after execution
Using Windows Browser testing,
Test successful, Configuration complete
About Ubuntu config file, strictly speaking Ubuntu Apache (or should say Linux under the Apache?) I am not sure that the configuration file for other distributions of the Apache package is that/etc/apache2/apache2.conf,apache automatically reads the configuration information for this file at startup. Some other configuration files, such as httpd.conf, are included through the include directive. These include lines can be found in apache2.conf:
Reference
# Include Module Configuration:
Include/etc/apache2/mods-enabled/*.load
Include/etc/apache2/mods-enabled/*.conf
# Include All the user configurations:
Include/etc/apache2/httpd.conf
# Include Ports Listing
Include/etc/apache2/ports.conf
......
# Include Generic snippets of statements
include/etc/apache2/conf.d/
# Include The virtual host configurations:
include/etc/apache2/sites-enabled/
Combined with annotations, you can clearly see the general effect of each configuration file. Of course, you can put all the settings in apache2.conf or httpd.conf or any configuration file. This division of Apache2 is only a good habit.
One of the most important things to do after installing Apache is to know where the Web document root directory is, and for Ubuntu, the default is/var/www. How do you know that? There is no documentroot in apache2.conf, httpd.conf is empty, so it must be in other files. After searching, found in the/etc/apache2/sites-enabled/000-default, there is such content:
Reference
Namevirtualhost *
<virtualhost *>
ServerAdmin Webmaster @localhost
documentroot/var/www/
CentOS httpd + Ubuntu conf location