安裝Fedora 23+Apache+PHP…

安裝Fedora 23

1.下載最新版Fedora 23 ISO 並燒成開機光碟

下載位址:https://getfedora.org/zh_TW/server/download/

2.開始安裝Fedora Server

Install Guide請參閱http://www.if-not-true-then-false.com/2015/fedora-23-install-guide/

3.安裝

a.Apache HTTP Server

b.MySQL/MariaDB database

c. PHP

d.Perl or Python

請參閱http://www.unixmen.com/how-to-install-lamp-stack-in-fedora-23/

重點整理如下:

install Apache:

dnf install httpd -y

Enable the httpd service to start automatically on every reboot:

systemctl enable httpd

Start httpd service using the following command:

systemctl start httpd

And adjust the firewall to allow the httpd service to access it from remote clients.

firewall-cmd –permanent –add-service=http

firewall-cmd –permanent –add-service=https

Restart firewalld service:

firewall-cmd –reload

Install MariaDB

dnf install mariadb mariadb-server -y

Enable mariadb service at boot time with following command:

systemctl enable mariadb

And start mariadb service using command:

systemctl start mariadb

Set MariaDB root password:

mysql_secure_installation

Install PHP

dnf install php -y

Test PHP:
Create a sample “testphp.php” file in Apache document root folder and append the lines as shown below:
vi /var/www/html/testphp.php
Add the following lines:

phpinfo();
?>

Restart httpd service:
systemctl restart httpd

安裝samba
dnf -y install samba samba-client

firewall-cmd –zone=public –add-port=445/tcp –permanent
firewall-cmd –zone=public –add-port=139/tcp –permanent
firewall-cmd –reload

firewall-cmd –zone=public –add-port=10000/tcp –permanent

or firewall-cmd –add-port=10001/tcp –permanent
firewall-cmd –reload

yum install vsftpd
/sbin/service vsftpd start

修改httpd.conf

vi /etc/httpd/conf/httpd.conf

Options Indexes FollowSymLinks
刪除Indexes,再重新啟動Apache,避免Apache列出目錄檔案

chcon -R -t httpd_sys_rw_content_t /var/www/html/

chgrp -R apache /var/www/html/特定目錄/

chown -R apache:apache /var/www/html/特定目錄/

設定可寫入權限
chmod 777 -R /var/www/html/要開放寫入的目錄/

移除webmin

/etc/webmin/uninstall.sh

======================

Fedora 23安裝完後的基本環境資訊

Apache/2.4.16 (Fedora)
OpenSSL/1.0.2d-fips
PHP/5.6.14
mod_wsgi/4.4.8
Python/2.7.10
mod_perl/2.0.9
Perl/v5.22.0
mysqlnd 5.0.11

=========================

這是以最新版Fedora23架設的Ntpc OpenID學生檔案系統。

http://mta.sjps.ntpc.edu.tw/stc/

上傳模組採用最新2015.11.02釋出的版本 CKFinder-3.1-for-PHP-Released,釋出不到1個月。

3.1版新增與修正內容:https://cksource.com/blog/CKFinder-3.1-for-PHP-Released

筆者新設計的系統,上傳檔案注意事項:

1.子目錄下,上傳檔案數量限制:1000個。
2.如果檔名相同時會覆蓋已上傳的檔案。
3.每個學生雲端容量調高為2GB。
4.單一檔案上傳限制1GB。
5.只能刪除自建的子目錄,不能刪除根目錄檔案。

每個學生使用Ntpc OpenID登入後,會自動建立一個專屬的雲端空間,同時也建置個人網頁空間。免申請、免管理帳號,相當便利!
個人網頁網址為: http://mta.sjps.ntpc.edu.tw/web104/學生學號

支援拖曳方式上傳檔案,圖片或照片類型會自動製作縮圖,可線上瀏覽或直接下載至本地。

=====================

vi /etc/vsftpd/vsftpd.conf

# chroot)
chroot_local_user=YES
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
pasv_enable=YES

讓root帳號可以ftp登入
vi /etc/vsftpd/chroot_list

加入 root

===============

wordpress 升級失敗
使用者名稱與密碼都正確,還是出現錯誤。

錯誤訊息如下:
連線 FTP 伺服器 stb.sjps.ntpc.edu.tw:21 失敗

原因是SELinux設定的關係,解決方式指令:
# setsebool -P httpd_can_network_connect on

==========
Apache log 路徑 /etc/httpd/logs/
Vsftpd ftp
禁止sshd 部分使用者連線
vi /etc/ssh/sshd_config
新增以下兩行
DenyUsers 使用者名稱
DenyGroups users

friber

By friber