apache+php项目部署
先安装apache和php然后进行如下操作(以63服务器的安装路径为例)
1.查看php项目运行的报错信息
路径: cd /var/log/httpd/error_log
如果错误如下:
可以尝试给需要写入的文件赋权限,例如: chmod 777 ../type.json
2.编辑httpd.conf文件,使apache支持php
[root@localhost conf]# vim /etc/httpd/conf/httpd.conf
1)找到 AddType text/html .shtml
在后面添加:
AddType application/x-httpd-php .php(使Apcche支持PHP)
AddType application/x-httpd-php-source .php5
2)找到 #ServerName www.example.com:8
修改为: ServerName localhost:80
3)找到 <IfModule dir_module> DirectoryIndex index.html </IfModule>
添加 <IfModule dir_module> DirectoryIndex index.html index.php </IfModule>
4)修改默认的Web站点目录
找到 DocumentRoot "/usr/local/apache2/htdocs"
修改为 DocumentRoot "/var/www/html" --该目录为自己创建的目录
找到 <Directory "/usr/local/apache2/htdocs">
修改为 <Directory "/var/www/html">
3.php项目包存放位置: /var/www/html
4.apche启动和停止
[root@localhost httpd]# /etc/init.d/httpd start
[root@localhost httpd]# /etc/init.d/httpd stop