Complete article with Apache stand and virtual host

zhaozj2021-02-16  90

If you are lucky enough, there is a registered Domain, there is a fixed IP address and the Internet connection, and it is an indispensable thing to set up a WWW server. Even if you haven't intended to formally connect to the Internet, you can have a WWW server on your intranet is also very convenient. Now the website on the Internet, most of them use Apache to do server. Set WWW

To set Apache, the key files are within / etc / httpd / conf / confes, and we only need to modify the three files: Access.conf httpd.conf srm.conf

However, if you see the following words in Access.conf and Srmm.conf: ## to avoid confusion, it is recommented That You put all of your # apache server directives Into the httpd.conf file and leave this # one essential empty . #

Then, all settings will be changed in httpd.conf, which may be different from the version. (TIPS: If you are editing with VI when you refer to this example, you can use the "/" key to find the keyword to make another modification.)

- Access.conf -

The first Access.conf file used to set some directory permissions: Options NoneAllowoverride None

Options Indexes Includes FollowsymlinkSallowoverride Allorder Allow, Denyallow from All

Here, I defined two directories (they must already exist), when the user has permission when it comes in through the HTTP connection. Because '/' (root directory) is tight, I don't open any Option, or not Override (when setting the SRM.conf file after setting, you can use '.htacess' to change the authority of the original directory).

However, I will allow INDEX below / home / httpd / virtual / virtual1 / directory, that is, when there is no preset index.html (set in srm.conf), the directory content is displayed in the traffic board. On; "FOLLOWSYMLINKS ', allows you to connect to the location outside this directory through the Symbolic Link mode. At the same time, in this directory, I also allows the setting of Allowoverride All, which I will explain it in SRM.CONF.

In addition, we can also specifically set the connection restrictions of this directory, 'Order Allow, Deny' is the range that allows the connection to allow the connection. But I am fully open here (Allow from ALL). But if you have necessary, you can add some Deny's sentences in this later, for example: Allow from alldeny from 203.168.168 as for other settings, you will slowly see the instructions above the file, usually accept the preset value. .

- httpd.conf -

Then, let's take a look at the file of httpd.conf. The front of the a large pile of 'loadModule' and 'addmodule' can ignore unless you really know how to modify it, you have to do it is correct. Then to: Servertype Standalone This setting is to let HTTPD start when boot. This setting is usually used, unless you want HTTPD to start in inetd.

Port 80 is a bit fun. As we know that the features of the port seem to have an IP address door, Port 80 is the preset value of HTTP's agreement (in / etc / services can be modified), if you want to create a secret website, just want Those friends who know the gates, then, change 80 to other numbers, otherwise, use the preset value.

Hostnamelookups Off If you want to know what the machine is connected to your website, set it to 'on', otherwise you will only see the IP address.

User NobodyGroup Nobody This is still not changed, you only need to make sure this 'Nobody' is available in / etc / passwd and / etc / group.

ServerAdmin root@redhat52.siyongc.domain changed to the managers that manage this website. Although I use root here, I suggest you change into WebMaster and then build a mailbox for WebMaster.

Bindaddress * If you want to set up a virtual host (later I will teach you how to do it), you can take the front "#". At the same time, the '#Listen 12.34.56.78:80' sentence (near line 323) increases the virtual IP address (including the IP address of the machine itself)

Listen 127.0.1:80Listen 192.168.0.17:80Listen 203.30.35.134:80Listen 10.11.127.100:8080listen 1927.100:8080Listen 192.168.1.17:80 ..... (Although you don't set BindadDress and Listen can make the virtual host work, but If your server also provides an HTTP-Proxy service, or use other port to provide other HTTPD services, you will be set.)

转载请注明原文地址:https://www.9cbs.com/read-13687.html

New Post(0)