1、安装 Apache2+PHP5+MySQL
sudo apt-get install apache2 libapache2-mod-php5 php5 php5-gd mysql-server php5-mysql phpmyadmin
joelhy 提醒 这一步可以使用新立得来安装,同样效果。
打开新立得,编辑 –> 使用任务分组标记软件包 –> 勾选 LAMP Server
然后再单独安装 phpmyadmin
sudo apt-get install phpmyadmin
2、启用 mod_rewrite 模块
sudo a2enmod rewrite
3、配置 apache2.conf
sudo gedit /etc/apache2/apache2.conf
去掉 AddHandler cgi-script .cgi 前的注释 “#”。
然后在任意地方添加这么一段:
&<60;&<60; &<60;DocumentRoot /var/www/
&<60;&<60; &<60;
&<60;&<60; &<60; &<60; &<60;Options FollowSymLinks
&<60;&<60; &<60; &<60; &<60;AllowOverride all
&<60;&<60; &<60;
&<60;&<60; &<60;
&<60;&<60; &<60; &<60; &<60;Options ExecCGI
&<60;&<60; &<60;
重启服务器
sudo /etc/init.d/apache2 restart
搞定。
说明:PHP 程序放 /var/www/ 下面都可以,CGI 程序放 /var/www/cgi-bin/ 下面。
是不是太简单了,除去下载的时间,要不了一分钟就可以完成配置,在 Ubuntu 上还需要 APM 包吗?还是记住以下几个命令和位置就行了。
sudo /etc/init.d/apache2 restart (重启 apache)
sudo gedit /etc/php5/apache2/php.ini (配置 php.ini)
sudo gedit /etc/apache2/apache2.conf (配置 apache2.conf)
/var/www/(主目录位置)
以上服务器配置,经测试可以正常运行 WordPress、Habari、Movable Type。
[分享]Ubuntu 7.04系统上安装Apache PHP MySQL
-
- 帖子: 7
- 注册时间: 2007-07-15 23:52
- bones7456
- 帖子: 8495
- 注册时间: 2006-04-12 20:05
- 来自: 杭州
- 联系:
-
- 帖子: 16
- 注册时间: 2007-05-12 13:59
求助:今天更新的apache
今天更新的apache中的 apache2.conf中好像没有了 AddHandler cgi-script .cgi
请问该如何操作?
请问该如何操作?
-
- 帖子: 356
- 注册时间: 2007-02-15 6:26
是挺简单的。新手快学。学会了,才好用我的软件拉。呵呵。
问:第3步是干什么的?
又问:第2步作了,似乎要设置什么的吧?在哪里设?又如何设?
举例:http://localhost/book/ubuntu/page2 和 http://localhost/book/ubuntu/page2/
跳到 http://localhost/book.php?category=ubuntu&page=2
怎么作?
再问:架个 https://localhost 怎么作?
问:第3步是干什么的?
又问:第2步作了,似乎要设置什么的吧?在哪里设?又如何设?
举例:http://localhost/book/ubuntu/page2 和 http://localhost/book/ubuntu/page2/
跳到 http://localhost/book.php?category=ubuntu&page=2
怎么作?
再问:架个 https://localhost 怎么作?
2007:琉璃地,旃檀林。心心作。念念是。
-
- 帖子: 1
- 注册时间: 2007-09-25 12:18
lee@lee-desktop:~$ sudo /etc/init.d/apache2 restart
* Forcing reload of web server (apache2)... Syntax error on line 518 of /etc/apache2/apache2.conf:
AllowOverride not allowed here
[fail]
我把518行的AllowOverride all注释后,继续如下:
lee@lee-desktop:~$ sudo /etc/init.d/apache2 restart
* Forcing reload of web server (apache2)... apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
httpd (no pid file) not running
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
为什么会这样?
我准备用Pythond代替PHP应怎么做,我原来用Python在Windows(运行正常)写了个webserver如下:
#########################################################################
# implement HTTP web server in Python which knows how to serve HTML
# pages and run server side CGI scripts; serves files/scripts from
# the current working dir and port 80, unless command-line args;
# python scripts must be stored in webdir\cgi-bin or webdir\htbin;
# more than one of these may be running on the same machine to serve
# from different directories, as long as they listen on different ports;
#########################################################################
webdir = '.' # where your html files and cgi-bin/htbin script directory live
port = 80 # http://servername/ if 80, else use http://servername:xxxx/
import os, sys
from BaseHTTPServer import HTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler
if len(sys.argv) > 1: webdir = sys.argv[1] # command-line args
if len(sys.argv) > 2: port = int(sys.argv[2]) # else default .,80
print 'webdir "%s", port %s' % (webdir, port)
# hack for Windows: os.environ not propogated
# to subprogress by os.popen2, force in-process
if sys.platform[:3] == 'win':
CGIHTTPRequestHandler.have_popen2 = False
CGIHTTPRequestHandler.have_popen3 = False # emulate path after fork
sys.path.append('cgi-bin') # else only adds my dir
os.chdir(webdir) # run in html root dir
srvraddr = ("", port) # my hostname, portnumber
srvrobj = HTTPServer(srvraddr, CGIHTTPRequestHandler)
srvrobj.serve_forever()
该脚本在Ubuntu不能正常运行,改了port为其它值就可以了,但用http://localhost/xxx.html不能访问了,所以装了apache2。
麻烦给指点下!
* Forcing reload of web server (apache2)... Syntax error on line 518 of /etc/apache2/apache2.conf:
AllowOverride not allowed here
[fail]
我把518行的AllowOverride all注释后,继续如下:
lee@lee-desktop:~$ sudo /etc/init.d/apache2 restart
* Forcing reload of web server (apache2)... apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
httpd (no pid file) not running
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
为什么会这样?
我准备用Pythond代替PHP应怎么做,我原来用Python在Windows(运行正常)写了个webserver如下:
#########################################################################
# implement HTTP web server in Python which knows how to serve HTML
# pages and run server side CGI scripts; serves files/scripts from
# the current working dir and port 80, unless command-line args;
# python scripts must be stored in webdir\cgi-bin or webdir\htbin;
# more than one of these may be running on the same machine to serve
# from different directories, as long as they listen on different ports;
#########################################################################
webdir = '.' # where your html files and cgi-bin/htbin script directory live
port = 80 # http://servername/ if 80, else use http://servername:xxxx/
import os, sys
from BaseHTTPServer import HTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler
if len(sys.argv) > 1: webdir = sys.argv[1] # command-line args
if len(sys.argv) > 2: port = int(sys.argv[2]) # else default .,80
print 'webdir "%s", port %s' % (webdir, port)
# hack for Windows: os.environ not propogated
# to subprogress by os.popen2, force in-process
if sys.platform[:3] == 'win':
CGIHTTPRequestHandler.have_popen2 = False
CGIHTTPRequestHandler.have_popen3 = False # emulate path after fork
sys.path.append('cgi-bin') # else only adds my dir
os.chdir(webdir) # run in html root dir
srvraddr = ("", port) # my hostname, portnumber
srvrobj = HTTPServer(srvraddr, CGIHTTPRequestHandler)
srvrobj.serve_forever()
该脚本在Ubuntu不能正常运行,改了port为其它值就可以了,但用http://localhost/xxx.html不能访问了,所以装了apache2。
麻烦给指点下!