rpm -Uvh http://nginx.org/packages/cen...
安装 yum install nginx
systemctl start nginx.service
rpm -Uvh https://dl.fedoraproject.org/...
rpm -Uvh https://mirror.webtatic.com/y...
安装php yum install -y php70w php70w-mysql.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-fpm
systemctl start php-fpm.service
增加一个nginx配置文件配置如下
server {
listen 80;
server_name test.com;
root /usr/share/nginx/html;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
client_max_body_size 100m;
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000; #tcp连接 还有socket连接
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* .(otf|eot|svg|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
location ~* ^.+.(jpg|jpeg|gif|png|swf|rar|zip|css|js|pdf|ico|html)$ {
access_log off;
expires 30d;
break;
}
location ~ /.ht {
deny all;
}
}
systemctl restart nginx
php-fpm配置文件位置:(/etc/php-fpm.d/www.conf)
修改
user =nginx
group=nginx
systemctl restart php-fpm.service
mysql
下载
wget https://dev.mysql.com/get/mys...
安装 mysql 源
yum localinstall mysql57-community-release-el7-11.noarch.rpm
yum install -y mysql-community-server
systemctl start mysqld
systemctl status mysqld
设置开机启动
shell> systemctl enable mysqld
重载所有修改过的配置文件
shell> systemctl daemon-reload
mysql 安装完成之后,生成的默认密码在 /var/log/mysqld.log 文件中。使用 grep 命令找到日志中的密码。
shell> grep 'temporary password' /var/log/mysqld.log
首次通过初始密码登录后,使用以下命令修改密码
shell> mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
默认只允许root帐户在本地登录,如果要在其它机器上连接mysql,必须添加一个允许远程连接的帐户。或者修改 root 为允许远程连接(不推荐)
添加一个允许远程连接的帐户
mysql> GRANT ALL PRIVILEGES ON . TO 'zhangsan'@'%' IDENTIFIED BY 'Zhangsan2018!'
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。