腾讯云上部署服务器应用环境

参考网站:https://www.qcloud.com/document/product/213/2975

本文档均以CentOS 7.1 64位为例进行说明。

  1. 安装及启动nginx

输入yum install nginx命令进行nginx的安装,当需要确认时输入”y“确认。

输入service nginx start启动nginx服务。

输入wget http://127.0.0.1测试nginx服务

  1. 安装PHP及相应组件

输入yum install php php-fpm命令进行PHP的安装,当需要确认时输入”y“确认。

输入service php-fpm start启动php-fpm服务,并使用命令cat /etc/php-fpm.d/www.conf |grep -i 'listen ='查看php-fpm配置。

上图可见php-fpm的默认配置的监听端口为9000,现在需要修改配置将php解析的请求转发到127.0.0.0:9000处理即可。

使用命令nginx -t查找nginx配置文件,并使用vi命令修改该配置文件:

在配置文件中找到以下片段,修改红色部分。

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;
}

}
修改后保存,输入service nginx restart重启nginx服务。

在web目录下创建index.php:

vi /usr/share/nginx/html/index.php
写入如下内容:

Test Page"; echo "hello world"; ?>

在浏览器中,访问CentOS云服务器公网IP+php网页名称查看环境配置是否成功,如果页面可以显示“hello world”,说明配置成功。

若您无法访问此网页,请查看您的服务器是否配置了安全组导致端口无法被访问。

  1. 通过Filezilla实现本地Windows上传文件到Linux服务器/从Linux服务器下载文件

本方法仅适合本地为Windows系统的用户,可实现将本地文件上传至Linux服务器/下载Linux服务器上的文件。本地为Linux系统的用户可直接使用SCP命令进行上传下载。

本地安装Filezilla客户端,参考下载地址:https://www.filezilla.cn/download/client

点击【文件】-【站点管理器】,点击【新站点】按钮,输入以下内容:

主机:Linux云服务器的公网IP
端口:远程连接端口,默认22
协议:选择【SFTP】ssh文件传输协议
登录类型:选择正常
用户:Linux云服务器的登录用户,默认为root/ubuntu
密码:Linux云服务器的登录密码
点击【连接】按钮,等待连接Linux云服务器。

连接成功后,左侧为本地文件,右侧为服务器端文件

posted on 2017-04-19 17:20  小码果  阅读(303)  评论(0编辑  收藏  举报

导航

Live2D