新建模拟器安装的阿里centos7 mini
安装完后发现没有可用ifconfig,查不到ip,网络不可用
解决方案https://blog.csdn.net/koevas/article/details/97496394
安装docker 解决方案 https://www.jianshu.com/p/c983b1ccbc27
安装showdoc 解决方案 https://www.showdoc.cc/help?page_id=65610
以上安装运行没有问题了。
如需二次开发需
安装Nginx + PHP
yum install nginx
yum install php php-gd php-fpm php-mcrypt php-mbstring php-mysql php-pdo
安装完后,在
/etc/nginx/conf.d
新建文件
127.0.0.1.conf
server {
listen 80;
server_name 127.0.0.1;
root /var/www/html;
index index.php index.html;
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location ~ \.php$ {
root /var/www/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
保存。然后执行命令:
service nginx start
service php-fpm start
chkconfig php-fpm on
chkconfig nginx on
然后进入目录
/var/www/html
(不存在则新建),将ShowDoc上传并按照部署手册
如启动nginx之后80不能访问,需对防火墙进行配置
第一步,对80端口进行防火墙配置:
firewall-cmd --zone=public --add-port=80/tcp --permanent
第二步,重启防火墙服务:
systemctl restart firewalld.service
然后重新在浏览器中访问你的ip,应该就可以访问了。
事后碰到个问题一直困扰我。怎么修改文件权限都不能开启PHP的写权限。因虚拟机使用,我将selinux给关了。
查看SELinux状态:
1、/usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态
SELinux status: enabled
2、getenforce ##也可以用这个命令检查
关闭SELinux:
1、临时关闭(不用重启机器):
setenforce 0 ##设置SELinux 成为permissive模式
##setenforce 1 设置SELinux 成为enforcing模式
2、修改配置文件需要重启机器:
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
重启机器即可