安装Nginx apt-get install nginx
systemctl start nginx ------设置nginx服务开机自启动 systemctl start nginx ------开启nginx服务 systemctl status nginx.service --------查看nginx状态
nginx -v
将www-data作为网站的根目录使用者,默认情况是root使用
chown www-data:www-data /usr/share/nginx/html/ -R
在安装nginx时候,默认创建用户www-data用户
cat /etc/passwd | grep www-data www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
安装mariadb数据库
apt-get install mariadb-server mariadb-client
配置mariadb数据库
mysql_secure_installation
安装PHP 插件
apt-get install php7.0 php7.0-fpm php7.0-mysql php-common php7.0-cli php7.0-common php7.0-json
PHP插件服务的启动及状态的查看
systemctl enable php7.0-fpm systemctl start php7.0-fpm systemctl status php7.0-fpm
vi /etc/nginx/sites-available/default
rm /etc/nginx/sites-enabled/default
vi /etc/nginx/conf.d/default.conf -------将以下文本粘贴到文件中。 将192.168.1.108替换为您的实际服务器IP地址。 server { listen 80; listen [::]:80; server_name 192.168.1.108; ----ip地址替换为自己的ip地址 root /usr/share/nginx/html/; index index.php index.html index.htm index.nginx-debian.html; location / { try_files $uri $uri/ /index.php; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; include snippets/fastcgi-php.conf; } location ~ /\.ht { deny all; } }
检查内核版本:
uname -a
1.确定系统是32位还是64位的:
getconf LONG_BIT
2.wget http://kernel.ubuntu.com/~kernel-ppa/mainline/ 下载最新的程序包
例如下载64位的4.10.2的内核:
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.2/linux-image-4.10.2-041002-generic_4.10.2-041002.201703120131_amd64.deb
3.切换文件下载目录,执行命令升级:
dpkg -i linux-image-4.10.2-041002-generic_4.10.2-041002.201703120131_amd64.deb
4.更新grub引导:
update-grub
5.reboot
CentOS6
临时关闭
service iptables stop
禁止开机启动
chkconfig iptables off
CentOS7默认使用firewalld
临时关闭
systemctl stop firewalld
禁止开机启动
systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.iptables-service
安装iptables
yum install -y iptables-services
关闭防火墙
service iptables stop
检查防火墙状态
service iptables status
#添加源
sudo add-apt-repository ppa:nm-l2tp/network-manager-l2tp
#update
sudo apt update
#安装network-manager-l2tp
sudo apt install network-manager-l2tp
#安装UI
sudo apt install network-manager-l2tp-gnome
apt-get install postfix
vi /etc/postfix/main.cf
sudo apt-get install dovecot-common dovecot-imapd dovecot-pop3d
vi /etc/dovecot/dovecot.conf
这里配置邮件的存放目录,这里和Postfix设置的要一致,都是在用户主目录下的Maildir目录下。
mail_location = maildir:~/Maildir
监听所有的端口
listen= *
允许明文密码验证
disable_plaintext_auth = no
使用ssl加密
ssl = required
ssl秘钥存放路径,目前这两个文件也是不存在的,也需要按照后面的步骤我们手动生成
ssl_cert =< /etc/ssl/certs/ssl-cert-snakeoil.pem
ssl_key =< /etc/ssl/private/ssl-cert-snakeoil.key
设置认证的默认选项,auth是一个socket文件,通过该文件dovecot和postfix进行通信,来传递postfix的认证信息,这里面的path要和postfix设置的一致。
auth default {
socket listen {
client {
path =/var/spool/postfix/private/auth
mode = 0660
user = postfix
group = postfix
}
}
service postfix restart
service dovecot restart