因为选择的语言是php找到了一个框架,lanewechat.
所以需要服务器环境为mysql+php+nginx当然也可以用apache2,只是个人觉得nginx比较好用。
首先电脑上已经装了nginx,安装方法也很简单,apt-get install nginx
在安装软件之前一般都要使用 apt-get install update安装更新,这个在安装apache2的时候有提到过。
nginx的配置文件路径为:/etc/nginx/nginx.conf
重启nginx命令:service nginx restart
下一步需要安装mysql
apt-get install mysql-server
这个中间会让输入root的密码
安装完成接下来安装php
apt-get install php5
安装php5的时候可能会提示各种apache2的错误,这个时候不用理会,让他自己安装下去。
安装完毕,安装php-fpm
apt-get install php-fpm
接下来php文件还是不能访问
是因为配置文件没有配好
接下来就要配置nginx.conf
修改location
server { listen 80; server_name xl.caiqr.com; root /root/html/mobileweb/view; index index.html index.htm index.php; location / { try_files $uri $uri/ /index.php; }
/etc/nginx/sites-available目录中有一个default文件,
直接编辑
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini # With php5-cgi alone: fastcgi_pass 127.0.0.1:9000; # With php5-fpm: fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; }
接下来根目录上传一个php文件index.php
<?php> echo('<p>not found</p>'); <?>输入域名,看见了not found而不是php文件被下载,恭喜环境安装成功了。