起因1是...Java系統都是tomcat...然後centos吵不是root不能bind 80....
我又不想用root跑tomcat...所以就只好加apache...
因2是...postgresql管理工具, 還是phpPgAdmin比較方便...
反正php都是活在apache下
因3是...因為網管議題乾脆都走http ws比較單純...
所以有東西會從內網proxy->DMZproxy->外網proxy
(喵的~ 我也不想搞成這樣)
因4是...apache(httpd)裝起來好快阿阿阿~~~
因5是...我已經在很努力的精簡過多的功能維護設定...
(之後維護的人接不起來...雖小的還是我~_~)
總之~ 基本架構就是apache+php+tomcat....
依不同的主機跟功能~ 會有兩兩配的情況, 還有os(centos, win server)配...
連安裝建置也要客制化真是要死了
(所以今年決定放棄之前比較熟悉ubuntu陣營了...主因是看到centos的桌面比ubuntu好很多...)
總之底下是php(以phpPgAdmin)安裝法...centos和win安裝差蠻多的~
su
##只要一行就裝完apache, 給個讚
yum -y install httpd
#change apache listen port
vim /etc/httpd/conf/httpd.conf
Listen 80 ( other port--> Listen *:9080)
/etc/rc.d/init.d/httpd start
###(if perssion deney check this)
getenforce
-->Enforcing
setenforce 0
getenforce
-->Permissive
service httpd start
#check log to see httpd is OK?
ps -ef | grep http
cat /var/log/httpd/error_log
##安裝PHP, 也是一行...好!
yum -y install php
##php test page
cd /var/www/html/
vim index.php
<?php
phpinfo();
?>
##restart httpd
service httpd restart
##test php
xxxx/index.php
##安裝phpPgAdmin...真好~
##不過有發生過yum找不到package...不知道是剛好被關掉還那邊網路檔掉??
yum install phpPgAdmin
#check conf, 預設就只開localhost, 不錯有sense...一般應用就是看情況再多加Allow
cat /etc/httpd/conf.d/phpPgAdmin.conf
<Location /phpPgAdmin>
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
# Allow from .example.com
</Location>
cat /etc/php.ini
#如果不知道被東西被裝到那邊去~ search file一下
#check where? (test ok it is /usr/share/phpPgAdmin)
find / -name phpPgAdmin
exit;
### 安裝湯姆貓, 個人習慣使用zip安裝, yum資料夾結構亂跑很難處理
### 使用一般user, 裝在預設8080就好
mkdir tomcat
cd tomcat
cp ~/apache-tomcat-7.0.26.tar.gz .
tar -zxv -f apache-tomcat-7.0.26.tar.gz
cd apache-tomcat-7.0.26
bin/startup.sh
## open browser link xxxx:8080 to test
### more setting
vim bin/catalina.sh
add
JAVA_OPTS="-Xms128m -Xmx1024m"
### use 80(apache2 proxy, ajp)
su
vim /etc/httpd/conf/httpd.conf
##(G)加在最底下,
##不要用/根目錄 轉導~ 會導致php或其他apache目錄被搶走~
##依需要使用對應之路徑就好
<VirtualHost *:80>
ServerName mybestappp.com
ServerAlias www.mybestapp.com
ProxyRequests Off
ProxyPreserveHost On
ErrorLog /etc/xxx/log/httpd.tomcat.error.log
CustomLog /etc/xxx/log/httpd.tomcat.log combined
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /tomcat ajp://localhost:8009/
ProxyPassReverse /tomcat ajp://localhost:8009/
ProxyPass /mywebapp ajp://localhost:8009/mywebapp
ProxyPassReverse /mywebapp ajp://localhost:8009/mywebapp
</VirtualHost>
service httpd restart
沒有留言:
張貼留言