首页 > 代码库 > 腾讯云的基本配置(ubuntu 14.04)

腾讯云的基本配置(ubuntu 14.04)

  因为想在微信上开发些东西,所以租用了一个月的腾讯云。

1.安装nginx

sudo apt-get install nginx

2.安装php5

sudo apt-get install php5-cgi php-apc php5-curl php5-gd php5-mysql php5-mcrypt php5-memcache php5-memcached

3.安装php-fpm

sudo apt-get install php5-fpm

4.启动php-fpm并查看其配置

sudo /etc/init.d/php5-fpm start
sudo gedit /etc/php5/fpm/pool.d/www.conf

  更改为 listen = 127.0.0.1:9000

5.配置nginx的配置文件

sudo gedit /etc/nginx/sites-available/default
#sudo gedit /etc/nginx/nginx.conf

在配置文件中找到以下片段并修改为如下。

 

server {
  listen       80;
  root   /usr/share/nginx/html;
  server_name  localhost;

  #charset koi8-r;
  #access_log  /var/log/nginx/log/host.access.log  main;

  location / {
      index  index.html index.htm;
  }

  #error_page  404              /404.html;

  # redirect server error pages to the static page /50x.html
  #
  error_page   500 502 503 504  /50x.html;
  location = /50x.html {
      root   /usr/share/nginx/html;
  }

  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  #
  location ~ \.php$ {
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index   index.php;
      fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
      include        fastcgi_params;
  }

}

6.重启nginx服务

  遇到报错

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

  使用命令关闭占用80端口的程序

sudo fuser -k 80/tcp

  再加载配置文件,重新启动即可

sudo nginx -c /etc/nginx/nginx.conf
sudo nginx -s reload
sudo service nginx restart

 

腾讯云的基本配置(ubuntu 14.04)