2014年2月27日 星期四

[LAMP] Settings

因為要做 DB 作業所以就來弄個需要裝個 Apache & MySQL
之前有在 FreeBSD 上裝過了,這次就換成 Ubuntu server
Server OS: Ubuntu 12.04.4 LTS



首先先裝個 Apache2 server and MySQL server
sudo apt-get install apache2
sudo apt-get install mysql-server
接下來就開始調校 Apache
在 Ubuntu 上 Apache 的主要設定檔是放在 /etc/apache/apache2.conf 而不是像 FreeBSD 是放在 httpd.conf
Reference: stackoverfolw
基本上裝完後他的東西都給的差不多了,只要加一些東西就可以啟動了
首先先複製一份新的設定檔用於網站
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mynewsite
然後在 /etc/apache2/sites-available/mynewsite 裏面加入 ServerName
ServerName mynewsite.example.com
裏面的 ServerAdmin 改成自己的 email
然後指定 apache 等等要讀的設定檔
sudo a2ensite joyqul
接下來啟動 apache server 即可 :D
sudo service apache2 start
他是在這時候執行 configtest,如果有錯就不會啟動
error 是放在 /var/log/apache2/error.log 裏面
要在網頁上跑 php 一樣是在 apache2.conf 裏面加上
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Reference: https://help.ubuntu.com/10.04/serverguide/httpd.html
接下來裝個 phpMyAdmin,Ubuntu 上一樣歡樂
sudo apt-get install phpmyadmin
基本上在這個版本因為他會自動在 apache2/conf.d/ 底下生成 phpmyadmin.conf ,所以基本上什麼都不用改就會動了…
不過遇到神祕的問題,明明裏面就有 Alias /phpmyadmin /usr/share/phpmyadmin 但是他就是不會跳轉… 後來查到神祕作法就直接 soft link 過去 /usr/share/phpmyadmin 了
Reference: https://help.ubuntu.com/community/phpMyAdmin
接下來就是簽憑證,按照 這篇 簽完憑證,然後再依照這篇修改設定檔 (複製 /etc/apache2/sites-available/default-ssl 到 /etc/apache2/sites-available/mysite-ssl 然後修改這篇)
然後
ln -s /etc/apache2/sites-available/mysite-ssl /etc/apache2/sites-enabled/mysite-ssl
然後就有 https 可以用惹 :D
Reference: http://ubuntuforums.org/showthread.php?t=806884

沒有留言:

張貼留言