內容選單標籤

2019年8月24日 星期六

CentOS7 PHP






# yum -y install httpd
# rpm -qa | grep httpd
httpd-tools-2.4.6-89.el7.centos.1.x86_64
httpd-2.4.6-89.el7.centos.1.x86_64
# systemctl start httpd.service
# systemctl enable httpd.service
# systemctl status httpd.service

# firewall-cmd --add-service=http --permanent
# firewall-cmd --reload
# firewall-cmd --list-all

http://192.168.1.9/


# yum -y install php
# rpm -qa | grep php
php-common-5.4.16-46.el7.x86_64
php-5.4.16-46.el7.x86_64
php-cli-5.4.16-46.el7.x86_64

# systemctl restart httpd.service

# vi /var/www/html/test.php
<?php
   phpinfo();
php?>


http://192.168.1.9/test.php


--------------  MariaDB          Ctrl-C --    exit   ------

# yum -y install mariadb-server
# rpm -qa | grep mariadb
mariadb-5.5.60-1.el7_5.x86_64
mariadb-server-5.5.60-1.el7_5.x86_64
mariadb-libs-5.5.60-1.el7_5.x86_64

# systemctl start mariadb.service
# systemctl is-active mariadb.service
# systemctl enable mariadb.service
# systemctl status mariadb.service



# mysqladmin -u root password db123456

# mysql -u root -p          //登入 MariaDB
Enter password:
MariaDB [(none)]>



MariaDB [(none)]> select @@datadir;      //資料庫儲存路徑
+-----------------+
| @@datadir       |
+-----------------+
| /var/lib/mysql/ |
+-----------------+
1 row in set (0.00 sec)



--------------- 伺服器字元集 character set 和連線校對 collaction   -------------

MariaDB [(none)]> show variables like 'character_set_server';
+----------------------+--------+
| Variable_name        | Value  |
+----------------------+--------+
| character_set_server | latin1 |
+----------------------+--------+

MariaDB [(none)]> set character_set_server='utf8';

MariaDB [(none)]> show variables like 'character_set_server';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| character_set_server | utf8  |
+----------------------+-------+



MariaDB [(none)]> show variables like 'collation_server';
+------------------+-------------------+
| Variable_name    | Value             |
+------------------+-------------------+
| collation_server | latin1_swedish_ci |
+------------------+-------------------+

MariaDB [(none)]> set collation_server='utf8_unicode_ci' ;

MariaDB [(none)]> show variables like 'collation_server';
+------------------+-----------------+
| Variable_name    | Value           |
+------------------+-----------------+
| collation_server | utf8_unicode_ci |
+------------------+-----------------+




--------------- 資料庫字元集 character set 和連線校對 collaction   -------------

MariaDB [(none)]> show variables like 'character_set_database';
+------------------------+--------+
| Variable_name          | Value  |
+------------------------+--------+
| character_set_database | latin1 |
+------------------------+--------+

MariaDB [(none)]> set character_set_database='utf8';

MariaDB [(none)]> show variables like 'character_set_database';  
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| character_set_database | utf8  |
+------------------------+-------+



MariaDB [(none)]> show variables like 'collation_database';
+--------------------+-----------------+
| Variable_name      | Value           |
+--------------------+-----------------+
| collation_database | utf8_general_ci |
+--------------------+-----------------+



------方法2 建立料庫時在設定-----------

MariaDB [kkdb]> create database testdb character set='utf8' collate='utf8_unicode_ci';

MariaDB [testdb]> show variables like '%database';
+------------------------+-----------------+
| Variable_name          | Value           |
+------------------------+-----------------+
| character_set_database | utf8            |
| collation_database        | utf8_unicode_ci |
| skip_show_database     | OFF             |
+------------------------+-----------------+





--------------- 資料表字元集 character set 和連線校對 collaction   -------------

MariaDB [class]> create table tblmen (mid int primary key auto_increment, na varchar(20), gra varchar(1), cla varchar(2), snum varchar(2), pwd varchar(10)) character set 'utf8' collate 'utf8_unicode_ci';

MariaDB [class]> show create table tblmen \G;                                   *************************** 1. row ***************************
       Table: tblmen
Create Table: CREATE TABLE `tblmen` (
  `mid` int(11) NOT NULL AUTO_INCREMENT,
  `na` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  `gra` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL,
  `cla` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL,
  `snum` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL,
  `pwd` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`mid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci











MariaDB [(none)]> show databases;
MariaDB [(none)]> create database kkdb;          // drop database kkdb;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> show databases;

MariaDB [(none)]> show engines \G;

MariaDB [(none)]> use kkdb;
Database changed
MariaDB [kkdb]>

MariaDB [kkdb]> create table tblmen (mid int primary key auto_increment, na varchar(20), accnt varchar(20), pwd varchar(20));
MariaDB [kkdb]> describe tblmen;
MariaDB [kkdb]> show tables;




MariaDB [kkdb]> show create table tblmen \G;
*************************** 1. row ***************************
       Table: tblmen
Create Table: CREATE TABLE `tblmen` (
  `mid` int(11) NOT NULL AUTO_INCREMENT,
  `na` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  `accnt` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  `pwd` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`mid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
1 row in set (0.00 sec)








----------------- select insert update delete ----------------------

MariaDB [kkdb]> insert into tblmen values('','kk1','act1','pwd1');
MariaDB [kkdb]> select * from tblmen;

MariaDB [kkdb]> update tblmen set na='kkk1',accnt='actt1',pwd='pwdd1' where mid=1;
MariaDB [kkdb]> select * from tblmen;

MariaDB [kkdb]> delete from tblmen where mid=1;
MariaDB [kkdb]> select * from tblmen;



-----------  匯出資料  --------

MariaDB [kkdb]> insert into tblmen values('','kk2','act2','pwd2');
MariaDB [kkdb]> select * into outfile 'tblmen.txt' from tblmen;

# ls /var/lib/mysql/kkdb
...  tblmen.txt

# cat /var/lib/mysql/kkdb/tblmen.txt
2       kk2     act2    pwd2



-----------  匯入資料  --------

# vi /var/lib/mysql/kkdb/tblmen.txt         // 區隔符號   Tab
3       kk3     act3    pwd3
4       kk4     act4    pwd4

MariaDB [kkdb]> load data local infile '/var/lib/mysql/kkdb/tblmen.txt' into table tblmen;
MariaDB [kkdb]> select * from tblmen;





----------  使用phpMyAdmin  -------------

# yum -y install epel-release          // 需要 epel套件庫支援才能安裝 phpMyAdmin
# yum -y install phpMyAdmin
# rpm -qa | grep phpMyAdmin
phpMyAdmin-4.4.15.10-3.el7.noarch



# vi /etc/httpd/conf.d/phpMyAdmin.conf
...
 <Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 192.168.1.103          //要連結到 phpMyAdmin 的IP位置
       Require ip 127.0.0.1
...
<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require ip 192.168.1.103
       Require ip 127.0.0.1
...

# systemctl restart httpd.service


http://192.168.1.9/phpMyAdmin/
登入
使用者名稱:root
密碼:db123456

資料庫-->建立新資料庫-->
kkdb  ;   utf8_general_ci   -->建立

建立資料表-->名稱:tblmen  -->欄位數:4  -->執行

名稱      型態           長度值    索引                A_I
mid        int                               PRIMARY      ˅
na          varchar        10       
accnt     varchar        10
pwd       varchar        10

預覽SQL
CREATE TABLE 'kkdb'.'tblmen' ('mid' INT NOT NULL AUTO_INCREMENT, 'na' VARCHAR(10) NOT NULL, 'accnt' VARCHAR(10) NOT NULL, 'pwd' VARCHAR(10) NOT NULL, PRIMARY KEY ('mid')) ENGINE = InnDB;

-->儲存








-------  index.php -----------------------------------------

# vi /var/www/html/index.php
<?php
if ($_POST["act"]=="login"){
        $db_link=mysql_connect("localhost","root","db123456");
        $db_sel=mysql_select_db("kkdb");
        $str_sel="SELECT * FROM `tblmen` WHERE `accnt`= '".$_POST["accnt"]."' AND `pwd`='".$_POST["pwd"]."'";

        $result=mysql_query($str_sel);
        $data_cnt=mysql_num_rows($result);

        if ($data_cnt==1){
                header("Location:list.php");
        }else{
                header("Location:index.php");
        }

}
?>

<html>
<head></head>
<body>
<h1 align="center">會員登入</h1>
<form action="" method="post" name="formAdd">
<table align="center">
<tr><td>帳號</td><td><input type="text" name="accnt"></td></tr>
<tr><td>密碼</td><td><input type="text" name="pwd"></td></tr>
<tr><td></td><td>
<input type="hidden" value="login" name="act">
<input type="submit" value="登入" name="ok">
</td></tr>
</table>
</form>
</body>
</html>




-------  list.php   -----------------------------------------

# vi /var/www/html/list.php
<?php
$db_link=mysql_connect("localhost","root","db123456");

mysql_query("SET NAMES 'utf8'");

$db_sel=mysql_select_db("kkdb");
$str_sel="select * from tblmen";
$result=mysql_query($str_sel);

?>


<html>
<head></he/ad>
<body>
<h1 align="center">學生系統</h1>
<p align="center"><a href="add.php">新增學生資料</a>   <a href="query.php">查詢學生資料</a></p>
<table align="center">
<tr><td>編號</td><td>名字</td><td>帳號</td><td>密碼</td></tr>

<?php
while ($tbl_rows=mysql_fetch_assoc($result)){
        echo "<tr>";
        echo "<td>".$tbl_rows["mid"]."</td>";
        echo "<td>".$tbl_rows["na"]."</td>";
        echo "<td>".$tbl_rows["accnt"]."</td>";
        echo "<td>".$tbl_rows["pwd"]."</td>";
        echo "<td><a href='update.php?mid=".$tbl_rows["mid"]."'>修改</a></td>";
        echo "<td><a href='delete.php?mid=".$tbl_rows["mid"]."'>刪除</a></td>";
        echo "</tr>";

}
?>

</table>
</body>
</html>




-------  add.php   -----------------------------------------

# vi /var/www/html/add.php
<?php
if ($_POST["act"]=="add"){
        $db_link=mysql_connect("localhost","root","db123456");

        mysql_query("SET NAMES 'utf8'");


        $db_sel=mysql_select_db("kkdb");
        $str_insert="INSERT INTO `tblmen`(`mid`, `na`, `accnt`, `pwd`) VALUES ('".$_POST["mid"]."','".$_POST["na"]."','".$_POST["accnt"]."','".$_POST["pwd"]."')";
        mysql_query($str_insert);
        header("Location:list.php");

}
?>

<html>
<head></head>
<body>
<h1 align="center">新增資料</h1>
<p align="center"><a href="list.php">返回主畫面</a></p>
<form action="" method="post" name="formAdd">
<table align="center">
<tr><td>編號</td><td><input type="text" name="mid"></td></tr>
<tr><td>名字</td><td><input type="text" name="na"></td></tr>
<tr><td>帳號</td><td><input type="text" name="accnt"></td></tr>
<tr><td>密碼</td><td><input type="text" name="pwd"></td></tr>
<tr><td></td><td>
<input type="hidden" value="add" name="act">
<input type="submit" value="新增" name="ok">
<input type="reset" value="清除" name="erase">
</td></tr>
</table>
</form>
</body>
</html>





-------  update.php   -----------------------------------------

# vi /var/www/html/update.php
<?php
$db_link=mysql_connect("localhost","root","db123456");


mysql_query("SET NAMES 'utf8'");


$db_sel=mysql_select_db("kkdb");

if ($_POST["act"]=="update"){
        $str_update="UPDATE `tblmen` SET `na`='".$_POST["na"]."',`accnt`='".$_POST["accnt"]."',`pwd`='".$_POST["pwd"]."' WHERE `mid` ='".$_POST["mid"]."'";


        mysql_query($str_update);
        header("Location:list.php");

}
$str_sel="SELECT * FROM `tblmen` WHERE `mid`='".$_GET["mid"]."'";
//echo $str_sel;

$result=mysql_query($str_sel);
$tbl_rows=mysql_fetch_assoc($result);
?>

<html>
<head></head>
<body>
<h1 align="center">修改資料</h1>
<p align="center"><a href="list.php">返回主畫面</a></p>
<form action="" method="post" name="formUpdate">
<table align="center">
<tr><td>編號</td><td><input type="text" name="mid" value="<?php echo $tbl_rows["mid"]; ?>" disabled></td></tr>
<tr><td>名字</td><td><input type="text" name="na" value="<?php echo $tbl_rows["na"]; ?>"></td></tr>
<tr><td>帳號</td><td><input type="text" name="accnt" value="<?php echo $tbl_rows["accnt"]; ?>"></td></tr>
<tr><td>密碼</td><td><input type="text" name="pwd" value="<?php echo $tbl_rows["pwd"]; ?>"></td></tr>

<tr><td></td><td>
<input type="hidden" value="<?php echo $tbl_rows["mid"]; ?>" name="mid">
<input type="hidden" value="update" name="act">
<input type="submit" value="更新" name="ok">
<input type="reset" value="清除" name="erase">
</td></tr>
</table>
</form>
</body>
</html>




-------  query.php   -----------------------------------------

# vi /var/www/html/query.php
<html>
<head></head>
<body>
<h1 align="center">會員查詢</h1>
<p align="center"><a href="list.php">返回主畫面</a></p>
<form action="" method="post" name="formQuery">
<table align="center">
<tr><td>姓名</td><td><input type="text" name="na"></td><td></td><td></td></tr>
<tr><td></td><td>
<input type="hidden" value="query" name="act">
<input type="submit" value="查詢" name="ok">
</td><td></td><td></td></tr>

<tr><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td></tr>

<tr><td>編號</td><td>姓名</td><td>帳號</td><td>密碼</td></tr>

<?php
if ($_POST["act"]=="query"){
        $db_link=mysql_connect("localhost","root","db123456");


        mysql_query("SET NAMES 'utf8'");


        $db_sel=mysql_select_db("kkdb");
        $str_sel="SELECT * FROM `tblmen` WHERE `na` LIKE '%".$_POST["na"]."%'";
//echo $str_sel;
        $result=mysql_query($str_sel);
        $data_cnt=mysql_num_rows($result);

       if ($data_cnt!=0){
                while ($tbl_rows=mysql_fetch_assoc($result)){
                        echo "<tr>";
                        echo "<td>".$tbl_rows["mid"]."</td>";
                        echo "<td>".$tbl_rows["na"]."</td>";
                        echo "<td>".$tbl_rows["accnt"]."</td>";
                        echo "<td>".$tbl_rows["pwd"]."</td>";
                        echo "</tr>";
                }
        }
}
?>



</table>
</form>
</body>
</html>



-------  delete.php   -----------------------------------------

# vi /var/www/html/delete.php
<?php
$db_link=mysql_connect("localhost","root","db123456");
$db_sel=mysql_select_db("kkdb");
$str_del="DELETE FROM `tblmen` WHERE `mid`='".$_GET["mid"]."'";
$result=mysql_query($str_del);
?>

<html>
<head></head>
<body>
<h1 align="center">資料刪除完畢!</h1>
<p align="center"><a href="list.php">返回主畫面</a></p>
</body>
</html>

2019年8月23日 星期五

CentOs7 vsftp




# yum -y install vsftpd
# rpm -qa | grep vsftpd
vsftpd-3.0.2-25.el7.x86_64

# systemctl start vsftpd
# systemctl enable vsftpd
# systemctl status vsftpd

# firewall-cmd --add-service=ftp --permanent
# firewall-cmd --reload
# firewall-cmd --list-all

# vi /etc/vsftpd/vsftpd.conf
...
anonymous_enable=NO

...
//當chroot_local_user=YES,chroot_list_enable=NO
//時,所有的使用者均不能切換到其他目錄。
chroot_local_user=YES

...
//不新增下面這個會報錯:500 OOPS
allow_writeable_chroot=YES
         
...
//啟動被動式(passivemode)檔案總管可上傳下載
pasv_enable=YES

# systemctl restart vsftpd.service



# getsebool -a|grep ftp*
# setsebool -P ftpd_full_access on
# setsebool -P tftp_home_dir on



# useradd s301
# passwd s301

# su -l s301
$ mkdir {01..50}
$ ls
01  04  07  10  13  16  19  22  25  28  31  34  37  40  43  46  49
02  05  08  11  14  17  20  23  26  29  32  35  38  41  44  47  50
03  06  09  12  15  18  21  24  27  30  33  36  39  42  45  48

$ su
密碼:
[root@centos s301]# cd
[root@centos ~]#

# chattr +a -R /home/s301        //+a只能以附加方式寫入

# ls /home/s301/*/1.docx        //列出班級每人的作業



ftp://s301@192.168.1.9/50
使用者名稱:301
密碼            :123456

//正確登入後,即可新增資料





CentOS7 samba


CentOS7 3.10.0-957.el7.x86_64
--------------------------------------------------------------------------------------------------------
# yum -y install samba

# rpm -qa | grep samba
samba-client-libs-4.8.3-6.el7_6.x86_64
samba-common-tools-4.8.3-6.el7_6.x86_64
samba-common-4.8.3-6.el7_6.noarch
samba-common-libs-4.8.3-6.el7_6.x86_64
samba-libs-4.8.3-6.el7_6.x86_64
samba-4.8.3-6.el7_6.x86_64

# systemctl start smb.service
# systemctl enable smb.service
# systemctl status smb.service


# firewall-cmd --add-service=samba --permanent
# firewall-cmd --reload
# firewall-cmd --list-all


-------系統根目錄---- /  內-----------------------------

# mkdir /Smb
# ls -Z /
drwxr-xr-x. root root unconfined_u:object_r:default_t:s0 Smb

# chcon -R -t samba_share_t /Smb
# chmod 777 /Smb
# ls -Z /
drwxrwxrwx. root root unconfined_u:object_r:samba_share_t:s0 Smb


# vi /etc/samba/smb.conf
...
[global]
workgroup = WORKGROUP
server string = Samba Server %v
security = user
map to guest = bad user
dns proxy = no

[Samba分享]
path = /Smb
browsable =yes
writable = yes
guest ok = yes
read only = no

# systemctl restart smb.service

\\192.168.1.9\Samba分享



-------使用者家目錄----/home  內-----------------------------

# useradd kk1
# passwd kk1
# mkdir /home/kk1/Smb

# ls -Z /home
drwx------. kk1 kk1 unconfined_u:object_r:user_home_dir_t:s0 kk1
# chmod 755 /home/kk1
# ls -Z /home
drwxr-xr-x. kk1 kk1 unconfined_u:object_r:user_home_dir_t:s0 kk1

# ls -Z /home/kk1
drwxr-xr-x. root root unconfined_u:object_r:user_home_t:s0 Smb
# chcon -R -t samba_share_t /home/kk1/Smb
# chmod 777 /home/kk1/Smb
# ls -Z /home/kk1
drwxrwxrwx. root root unconfined_u:object_r:samba_share_t:s0 Smb


# vi /etc/samba/smb.conf
...
[global]
workgroup = WORKGROUP
server string = Samba Server %v
security = user
map to guest = bad user
dns proxy = no

[Samba分享]
path = /home/kk1/Smb
browsable =yes
writable = yes
guest ok = yes
read only = no



# systemctl restart smb.service

\\192.168.1.9\Samba分享

-----即可新增、刪除檔案





2019年8月21日 星期三

CentOS7 Apache




CentOS7 3.10.0-957.el7.x86_64
----------------------------------------------------------------------------------------------------------------
# yum -y install httpd
# rpm -qa | grep httpd
httpd-tools-2.4.6-89.el7.centos.1.x86_64
httpd-2.4.6-89.el7.centos.1.x86_64

# systemctl start httpd.service
# systemctl enable httpd.service
# systemctl status httpd.service

# ls /etc/httpd
conf  conf.d  conf.modules.d  logs  modules  run



# firewall-cmd --add-service=http --permanent
success
# firewall-cmd --reload
success
# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources:
  services: ssh dhcpv6-client http
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:


http://192.168.1.9/

----------------------------------以上即可看到 Testing 123...






設定虛擬目錄 Alias-------在其他的系統目錄--/opt---------------------------------------------

# ls -a /
...
drwxr-xr-x.   2 root root    6  4月 11  2018 opt
...

# mkdir /opt/docs
# echo Hello Alias > /opt/docs/index.html

# ls -l /opt
drwxr-xr-x. 2 root root 24  8月 19 22:45 docs
# ls -l /opt/docs
-rw-r--r--. 1 root root 12  8月 19 22:45 index.html


# vi /etc/httpd/conf/httpd.conf
...
Alias /kk1web /opt/docs
<Directory /opt/docs>
   Require all granted
</Directory>
...

# systemctl restart httpd.service

http://192.168.1.9/kk1web/




設定虛擬目錄 Alias-------在--/home---------------------------------------------


# vi /var/www/html/1.html
This is in /var/www/html ...

http://192.168.1.9/1.html




# mkdir /home/myweb
# vi /home/myweb/1.html
This is ONE ...


# vi /etc/httpd/conf/httpd.conf
...
Alias /web01 /home/myweb
<Directory "/home/myweb">
    Require all granted
</Directory>


# systemctl restart httpd.service

http://192.168.1.9/web01/1.html
403 Forbidden
You don't have permission to access /web01/1.html on this server.

# tail -1 /var/log/httpd/error_log
[Tue Aug 20 22:14:20.091625 2019] [core:error] [pid 7541] (13)Permission denied: [client 192.168.1.104:56320] AH00035: access to /web01/1.html denied (filesystem path '/home/myweb/1.html') because search permissions are missing on a component of the path




# ls -Z /var/www
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 html

# ls -Z /var/www/html
-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 1.html


# ls -Z /
drwxr-xr-x. root root system_u:object_r:usr_t:s0       opt

# ls -Z /home
drwxr-xr-x. root root unconfined_u:object_r:home_root_t:s0 myweb
# ls -Z /home/myweb
-rw-r--r--. root root unconfined_u:object_r:home_root_t:s0 1.html


# chcon -t httpd_sys_content_t /home/myweb
# ls -Z /home
drwxr-xr-x. root root unconfined_u:object_r:httpd_sys_content_t:s0 myweb



# vi /home/myweb/2.html
This is TWO in /home/myweb ...

# ls -Z /home/myweb
-rw-r--r--. root root unconfined_u:object_r:home_root_t:s0 1.html
-rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 2.htm                             l


http://192.168.1.9/web01/2.html    --OK
http://192.168.1.9/web01/1.html    --Not OK


**結論**
先以 chcon 變更目錄的 SELinux 的安全性本文 Security Context 及標記 Label
再產生網頁。







使用者家目錄 -------在--/home/*/public_html---------------------------------------------

# vi /etc/httpd/conf.d/userdir.conf
<IfModule mod_userdir.c>
    ...
#    UserDir disabled
    ...
    UserDir public_html
</IfModule>
...
<Directory "/home/*/public_html">
#    AllowOverride FileInfo AuthConfig Limit Indexes
#    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
#    Require method GET POST OPTIONS
     Require all granted
</Directory>


# systemctl restart httpd.service


---------------------------- 新增其他使用者,套用以下即可 ---------------------------- 

# useradd kk1
# passwd kk1      //123456

# mkdir /home/kk1/public_html


# ls -Z /home
drwx------. kk1 kk1 unconfined_u:object_r:user_home_dir_t:s0 kk1
# chmod 711 /home/kk1

# ls -Z /home/kk1
drwxr-xr-x. root root unconfined_u:object_r:httpd_user_content_t:s0 public_html
# chcon -R -t httpd_sys_content_t /home/kk1/public_html


-------------------------------------------------------
# getsebool -a | grep httpd         
# setsebool -P httpd_enable_homedirs on
-------------------------------------------------------可以不用


# vi /home/kk1/public_html/index.html
This page is in /home/kk1/public_html ...


http://192.168.1.9/~kk1/










2019年8月16日 星期五

CentOS7 Setup



CentOS7 3.10.0-957.el7.x86_64

安裝-----------------------------------------------------------------------------------------------

主機板ASUS P8H61 MLX PLUS
BIOS Advanced Mode:
Advanced--->CPU Configuration--->Intel Virtualization Technology--->Enabled
















# uname -r
3.10.0-957.el7.x86_64


# date
五  8月 16 23:21:04 CST 2019