hti 发表于 2018-11-28 08:25:43

redhat

#installmod-ssl under web server in system-config-packages

Secure webpage default page need to add DirectoryIndexin front of VirtualHostdirectory
DirectoryIndexsec.html   in /etc/httpd/conf.d/ssl.conf

Normal page the dedault page will be in /etc/httpd/conf/httpd.conf
DirctoryIndex ditectory already in the file.

chcon -R --reference=/var/www/html/var/www/html/sec to change the context

httpd -S to check the syntax

update /etc/hosts or master zone file in dns server

test : elinks inst.example.com for normal webpage
elinks https://sec.example.com for secure webpage


user basic security to website

AuthType   Basic
AuthName   "check Passwd"
AuthuserFile   /var/www/html/pass
Require User   xing


htpasswd -c /var/www/html/pass xingto create user.

give access to 2 uesrs

authtype basic
authname "whatever"
authuserfile/var/www/html/pass
requirevalid-user


service httpd reload

htpasswd -m /var/www/html/pass user1

chgrp apache /var/www/html/pass
chmod g+r/var/www/html/pass

also we can also add index.html to VirtualHost section.

#setup or system-config-securitylevel to enable https when access from remote (both server and client)

another way to chcon

#semanage fcontext -a -t httpd_sys_content_t '/www(/.*)?'

#restorecon -vvFR /www















页: [1]
查看完整版本: redhat