摘要:记录下在阿里云搭建开发环境安装安装完成后会自动开启,通过命令查看浏览器打开可以看到的欢迎页面安装开启配置解析为项目代码所在目录填写购买的阿里云外网或者自己已经解析备案的域名更改未被注释
记录下在阿里云搭建 PHP7 开发环境
安装 nginxsudo apt-get update
sudo apt-get install nginx
安装完成后会自动开启,通过命令查看
# ps -aux |grep nginx
root 7921 0.0 0.0 14232 972 pts/0 S+ 21:25 0:00 grep --color=au
to nginx
root 27770 0.0 0.0 117084 1444 ? Ss 20:39 0:00 nginx: master p
rocess /usr/sbin/nginx -g daemon on; master_process on;
www-data 27771 0.0 0.0 117404 3084 ? S 20:39 0:00 nginx: worker p
rocess
www-data 27772 0.0 0.1 117692 5120 ? S 20:39 0:00 nginx: worker p
rocess
浏览器打开 http://x.x.x.x.com/ 可以看到 nginx 的欢迎页面
安装 PHP7
sudo apt-get install python-software-properties software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get install php7.0-fpm php7.0-cli php7.0-mcrypt php7.0-mysql php7.0-mbstring php7.0-xml php7.0-curl
开启OPcache
apt-get install php70-php-opcache.x86_64
sudo service php7.0-fpm restart
配置 nginx 解析 PHP
vi /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
#root 为项目代码所在目录
root /var/www/html;
index index.php index.html index.htm;
#填写购买的阿里云外网IP或者自己已经解析备案的域名
server_name http://x.x.x.x/;
#更改未被注释一行
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
#添加下面代码
location ~ .php$ {
try_files $uri $uri/ =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
sudo vi /etc/php/7.0/fpm/php.ini
cgi.fix_pathinfo=0
sudo phpenmod mcrypt
sudo service php7.0-fpm restart
sudo service nginx restart
vi test.php
安装 MySQL
# 默认安装 MySQL 5.7
sudo apt-get install mysql-server mysql-client
#设置好密码后登陆
mysql -u root -p
安装 redis
sudo apt-get install git
git clone -b php7 https://github.com/phpredis/phpredis.git
mv phpredis/ /etc/
cd /etc/phpredis
sudo apt install php7.0-dev
#生成编译文件
phpize
sudo ./configure
make && make install
find / -name redis.so
/etc/phpredis/.libs/redis.so
/etc/phpredis/modules/redis.so
/usr/lib/php/20151012/redis.so
vim /etc/php/7.0/apache2/php.ini
extension=/etc/phpredis/modules/redis.so
sudo service php7.0-fpm restart
ps -aux |grep redis
root 7981 0.0 0.0 14232 1024 pts/0 S+ 21:40 0:00 grep --color=auto redis
redis 30952 0.0 0.1 40136 6716 ? Ssl 20:59 0:02 /usr/bin/redis-server 127.0.0.1:6379
redis-cli
127.0.0.1:6379> info
# Server
redis_version:3.0.6
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:687a2a319020fa42
redis_mode:standalone
os:Linux 4.4.0-79-generic x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:5.3.1
process_id:30952
run_id:056f34665607470e822036784d93cbbe079080a7
tcp_port:6379
uptime_in_seconds:2792
uptime_in_days:0
vi test.php
connect("127.0.0.1","6379");
上传代码
scp -r . root@x.x.x.x:/var/www/html
参考
阿里云Ubuntu14+PHP7+Nginx+Mysql环境搭建
在阿里云上部署Laravel应用
阿里云ECS部署Laravel+PHP7+Nginx
Nginx配置https访问
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/39594.html
摘要:记录下在阿里云搭建开发环境安装安装完成后会自动开启,通过命令查看浏览器打开可以看到的欢迎页面安装开启配置解析为项目代码所在目录填写购买的阿里云外网或者自己已经解析备案的域名更改未被注释 记录下在阿里云搭建 PHP7 开发环境 安装 nginx sudo apt-get update sudo apt-get install nginx 安装完成后会自动开启,通过命令查看 # ps ...
摘要:一步一步教你基于搭建自己的个人博客,作为成熟的框架,美观,方便,插件多,更新频繁,非常适合个人博客与网站的搭建,适合新手,无需太多的代码基础。原文链接手把手教你搭建自己的网站购买购买云服务器为了搭建个人网站,首先肯定需要一个云服务器。 一步一步教你基于WordPress搭建自己的个人博客,WordPress作为成熟的CMS框架,美观,方便,插件多,更新频繁,非常适合个人博客与网站的搭建...
阅读 1964·2021-11-24 09:39
阅读 2410·2021-09-30 09:47
阅读 4329·2021-09-22 15:57
阅读 2060·2019-08-29 18:36
阅读 3697·2019-08-29 12:21
阅读 707·2019-08-29 12:17
阅读 1379·2019-08-29 11:25
阅读 840·2019-08-28 18:26