Landing Xshell When encountered a problem, suddenly can not log on as:
1. Check virtual machine Virtual network editor, change to the following configuration, here the name is your network connection is the same, find a connection to the Internet, do not use automatic.
httpd
Port-based creation
[[email protected] conf.d]# rpm -ql httpd/etc/httpd/etc/httpd/conf/etc/httpd/conf.d/etc/httpd/conf.d/README/etc/httpd/conf.d/welcome.conf/etc/httpd/conf/httpd.conf/etc/httpd/conf/magic/etc/httpd/logs/etc/httpd/modules/etc/httpd/run/etc/logrotate.d/httpd/etc/rc.d/init.d/htcacheclean/etc/rc.d/init.d/httpd/etc/sysconfig/htcacheclean/etc/sysconfig/httpd/usr/lib64/httpd
[[email protected] conf.d]# vim /etc/httpd/conf/httpd.confListen 8080 (添加监听端口)
[[email protected] conf.d]# pwd/etc/httpd/conf.d[[email protected] conf.d]# vim test.conf <VirtualHost *:8080> ServerAdmin 888.com (这里可有可无,类似标签) DocumentRoot /var/www/test (这里必须有,此文件的路径) ServerName www.888.com (自定义域名) ErrorLog logs/www.888.com-error_log CustomLog logs/www.888.com-access_log common </VirtualHost>此内容在6系统里有模板: /etc/httpd/conf/httpd.conf(最后面能看到)~
[[email protected] conf.d]# mkdir /var/www/test[[email protected] conf.d]# echo 888 > /var/www/test/index.html[[email protected] conf.d]# service httpd restartStopping httpd: [ OK ]Starting httpd: [ OK ]
Windows here:
(To add parsing in the host file)
**基于名称**
[Email protected] ~]# vim/etc/httpd/conf/httpd.conf
# use name-based virtual hosting.
#
#NameVirtualHost *:80 (Remove the previous note, the 6 system is so, 7 opens by default)
[Email protected] conf.d]# cp-p test.conf baidu.conf
[Email protected] conf.d]# cp-p test.conf taobao.conf
[Email protected] conf.d]# vim baidu.conf
[Email protected] conf.d]# vim baidu.conf
[Email protected] conf.d]# mkdir/var/www/baidu.com
[Email protected] conf.d]# echo "wo shi bai du" >/var/www/baidu.com/index.html (Default identification index.html)
[Email protected] conf.d]# service httpd restart
stopping httpd: [OK]
Starting httpd: [Tue May 22:35:52 2018] [warn] default VirtualHost overlap on port 8080, the first has precede nCE
[OK]
* (using Windows test, same as Port-based addition)
**http针对目录做限制**
[email protected] conf.d]# cat taobao.conf
<virtualhost *:80>
Documentroot/var/www/taobao.com
ServerName www.taobao.com
Errorlog Logs/www.888.com-error_log
Customlog Logs/www.888.com-access_log Common
</VirtualHost>
Alias/boke1 "/var/www/baicu.com/" (that is, you open boke1, you will jump to the next designated place, here is the/baidu.com/,/can not be less)
<directory "/var/www/taobao.com" > (Restricted for directory)
Options-indexes (here can write a lot of control statements, here will not repeat)
</Directory>
[Email protected] conf.d]# vim welcome.conf
<locationmatch "^/+$" >
Options-indexes (front-Rep does not show home page) (I'll get rid of it here first)
ErrorDocument 403/error/noindex.html
</LocationMatch>
Links www.taobao.com (e.g.)
**网站认证**
[Email protected] conf.d]# vim taobao.conf
<virtualhost *:80>
Documentroot/var/www/taobao.com
ServerName www.taobao.com
Errorlog Logs/www.888.com-error_log
Customlog Logs/www.888.com-access_log Common
</VirtualHost>
<directory "/var/www/taobao.com" >
AllowOverride authconfig
AuthName "Login"
AuthType Basic
AuthUserFile "/etc/httpd/login"
Require Valid-user
</Directory>
[[email protected] conf.d]# Htpasswd-cmb/etc/httpd/login boke1 123 (create user and password, the second creation will not add option C)
Adding Password for user boke1
[Email protected] conf.d]# Cat/etc/httpd/login
Boke1: $apr 1$h93q.smi$f6.yyv2iggymzn4m4y.tm.
Turn off the firewall first when testing
* (note here that the principle of 6 and 7 is the same, that is, some of the wording is different)
**防火墙**http://blog.51cto.com/13559618/2062203 (这里写的不错)
Linux basic Services (ii)