Install centos, ubuntu, windows2012 system problems ---- Summary

1, not on the network after centos Lite installation:
into the / etc / sysconfig / network-scripts
to modify ifcfg-ens33
Here Insert Picture Description
Here Insert Picture Description
will be modified to ONBOOT yes
Here Insert Picture Description
it can restart after

2, centos change the host name
Here Insert Picture Description
Here Insert Picture Description

3, ubuntu source exchange
1> back up the original source files source.list
the desktop open the terminal, execute the command: the sudo CP /etc/apt/sources.list /etc/apt/sources.list.bak
2> source.list modify the source file
( 1) terminal to execute the command: sudo chmod 777 /etc/apt/source.list change file permissions to make it editable;
(2) execute the command: sudo gedit /etc/apt/source.list open the file for editing;
(3) delete the original content of the document, a copy of any of the following into it and save (common source and Tsinghua source is Ali, Ali recommended source)

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

3> Update Source:
sudo APT Update

4、centos换源
1>备份本地yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak
2>获取阿里yum源配置文件
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3>更新cache
yum makecache
4>安装
yum -y update

5、ubuntu如果用xshell无法连接,则需要安装:
sudo apt-get install openssh-server

6、centos是通过防火墙控制端口开放:
查看已经开放的端口:firewall-cmd --list-ports
开启端口:firewall-cmd --zone=public --add-port=80/tcp --permanent

#重启firewall  
firewall-cmd --reload  
#停止firewall  
systemctl stop firewalld.service  
#禁止firewall开机启动  
systemctl disable firewalld.service

7、centos安装nginx,php和配置流程:
nginx安装:

rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

yum install -y nginx

systemctl start nginx    //开启nginx
systemctl status nginx   //查询nginx状态
systemctl stop nginx    //停止nginx服务
systemctl enable nginx    //设置开机自启动

yum安装php-fpm相关组件:

yum -y install php php-fpm php-gd php-mysql php-common php-pear php-mbstring php-mcrypt

systemctl status php-fpm   //查看状态
systemctl start php-fpm    //开启
systemctl enable php-fpm   //开机自启动

编辑/etc/nginx/conf.d/default.conf并添加以下内容以支持php

vim /etc/nginx/conf.d/default.conf

#
location ~ \.php$ {
    root           /usr/share/nginx/html;    //这儿需要改
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name; //这个需要改
    include        fastcgi_params;
}

Here Insert Picture Description
这里的index后面加上一个index.php,之后部署项目的时候,root那里修改网站所在目录,然后在index后面添加打开定位的文件如index.php即可
建立index.php文件并测试

vim /usr/share/nginx/html/index.php

<?php
    phpinfo();
?>

Here Insert Picture Description

8、centos部署项目遇到403的时候:
这篇文章真的好,有用:
四种解决Nginx出现403 forbidden 报错的方法:
https://www.jianshu.com/p/e008d6b76bdf

9、ubuntu安装nginx+php,并配置:
安装nginx:

sudo apt-get install nginx
sudo service nginx start   //开启
sudo service nginx status  //查看状态
sudo service nginx stop  //停止
sudo service nginx restart   //重启

安装php和php-fpm:

sudo apt-get install php php-fpm  php-mysql php-gd php-mbstring
sudo service php7.2-fpm start   //开启
sudo service php7.2-fpm status   //查看状态
sudo service php7.2-fpm stop   //停止
sudo service php7.2-fpm restart   //重启

配置nginx的php环境:

cd /etc/nginx/sites-available
//修改default
sudo vim default
//将下面对应的#字号去掉
location ~ \.php$ {
                include snippets/fastcgi-php.conf;
#
#       # With php-fpm (or other unix sockets):
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
 //(要和 /etc/php/7.2/fpm/pool.d 中的 www.conf 中的 listen = /run/php/php7.2-fpm.sock 一致)
#       # With php-cgi (or other tcp sockets):
#       fastcgi_pass 127.0.0.1:9000;
}
//之后去/var/www/html,新建index.php,添加内容
<?php
	phpinfo();
?>
//nginx配置文件编译和重启
sudo nginx -t
sudo service nginx restart

结果如下:
Here Insert Picture Description
设置开机自启动:
nginx服务:sudo systemctl enable nginx.service
php7.2-fpm服务: sudo systemctl enable php7.2-fpm.service

赋予写的权限:
sudo chmod -R 777 dvwa

10、windows2012中VMware虚拟化安装Tools时候提示更新KB2919355:
解决方法:https://www.xxshell.com/1430.html

11、windows2012安装nginx和php
链接:https://www.cnblogs.com/huayangmeng/archive/2011/06/15/2081337.html

12、Windows2012开机启动项设置
链接:https://blog.csdn.net/tmtongming/article/details/77155677

13, Ubuntu which modified the nginx configuration files, be sure to enter the following:
sudo nginx -s reload, or restart after failure, had to restart

14, nginx configuration of load balancing centos:
link:
https://www.cnblogs.com/iforever/p/4246352.html
https://www.linuxidc.com/Linux/2015-12/125875.htm

Published 271 original articles · won praise 33 · views 80000 +

Guess you like

Origin blog.csdn.net/qq_36386435/article/details/104332820