新建模擬器安裝的阿里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
重啓機器即可