ubuntu安装apache2
2016-03-31 14:55
525 查看
ubuntu版本: ubuntu 12.04.4
1. 安装
$ sudo apt-get install apache2
2. 停掉apache服务
$ sudo /etc/init.d/apache2 stop
3. 启动apache服务
$ sudo /etc/init.d/apache2 start
此时,出现一个警告:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1
Set the 'ServerName' directive golbally to suppress this message
此时给apache服务添加一个服务器的域名即可
$ sudo vim /etc/apache2/apache2.conf
在最后面加一行:
ServerName localhost:80
保存,退出
然后重启apache服务:
$ sudo /etc/init.d/apache2 restart
此时,再无错误报出,后面出现[OK]字样,说明启动成功
4. 测试apache是否安装成功
在浏览器中输入: http://10.20.77.70/
回车,出现Apache2 Debian Default Page
说明apache安装成功
5. 测试PHP是否安装成功
在/var/www目录下新建一个脚本 phpinfo.php,内容如下:
<?PHP
phpinfo();
?>
浏览器中输入如下内容:http://10.20.77.70/phpinfo.php
回车,界面上显示PHP的内容,说明PHP安装成功
6. 测试PHP脚本能否正常解析
在/var/www目录下新建一个脚本echo.php, 内容如下:
<?PHP
echo "hello"."\n";
?>
浏览器中输入如下内容:http://10.20.77.70/echo.php
回车,界面上显示hello,说明PHP脚本可以成功解析
1. 安装
$ sudo apt-get install apache2
2. 停掉apache服务
$ sudo /etc/init.d/apache2 stop
3. 启动apache服务
$ sudo /etc/init.d/apache2 start
此时,出现一个警告:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1
Set the 'ServerName' directive golbally to suppress this message
此时给apache服务添加一个服务器的域名即可
$ sudo vim /etc/apache2/apache2.conf
在最后面加一行:
ServerName localhost:80
保存,退出
然后重启apache服务:
$ sudo /etc/init.d/apache2 restart
此时,再无错误报出,后面出现[OK]字样,说明启动成功
4. 测试apache是否安装成功
在浏览器中输入: http://10.20.77.70/
回车,出现Apache2 Debian Default Page
说明apache安装成功
5. 测试PHP是否安装成功
在/var/www目录下新建一个脚本 phpinfo.php,内容如下:
<?PHP
phpinfo();
?>
浏览器中输入如下内容:http://10.20.77.70/phpinfo.php
回车,界面上显示PHP的内容,说明PHP安装成功
6. 测试PHP脚本能否正常解析
在/var/www目录下新建一个脚本echo.php, 内容如下:
<?PHP
echo "hello"."\n";
?>
浏览器中输入如下内容:http://10.20.77.70/echo.php
回车,界面上显示hello,说明PHP脚本可以成功解析
相关文章推荐
- 使用Apache Axis框架进行WebService开发
- 将Flask部署到apache2
- ubuntu卸载apache2
- 关于Apache 工具包的一些记录,希望以后项目可以多多使用。
- [随手记]Android import org.apache.commons.codec.binary.Base64
- apache commons fileupload 1.3.1(七)FileItemFactory部分
- Apache Shiro 快速入门教程,shiro 基础教程
- redmine + apache + mod_fcgid
- apache mod_rewrite
- apache mod_rewrite
- Ubuntu下Apache web服务器的安装、配置及相关操作
- Maven 遇到mybatis 发生org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- Windows7下PHP5.6.19+Apache2.4.18+MySql5.7环境配置
- ubuntu14.04配置Apache使用CGI
- Django + Apache + wsgi配置和环境搭建(ubuntu)
- CentOS-7-64bit 配置Apache + MySQL + PHP
- ubuntu下apache2 安装 配置 卸载 CGI设置 SSL设置
- 导入文章“Apache Spark学习:将Spark部署到Hadoop 2.2.0上”中给出的 assembly/target/scala-2.9.3/目录下的spark-assembly-0.8.
- apache phoenix UDF example
- apache commons fileupload 1.3.1(六)FileItem部分