centos系统部署

系统部署:
1.查询系统版本
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
2.安装 wget
yum –y install wget
[root@localhost tmp]# yum -y install wget
3.NGINX下载资源包
4.建立nginx的yum仓库
[root@localhost tmp]# rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
5.安装NGINX
[root@localhost tmp]# yum -y install nginx
6.启动nginx
[root@localhost tmp]# systemctl start nginx.service
7.查看nginx状态
[root@localhost tmp]# service nginx status
[root@localhost tmp]# systemctl status nginx.service
8.启动成功
 
9. MYSQL下载资源包
10.建立mysql的yum仓库
[root@localhost tmp]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
 
11.安装MYSQL
[root@localhost tmp]# yum -y install mysql-server
12.启动mysql
[root@localhost lib]# systemctl start mysql.service
13.查看mysql状态
[root@localhost lib]# service mysql status
 
14.测试是否安装成功
[root@localhost lib]# mysql -u root
 
15.PHP加载remi源 (如果源失效百度自查)
# yum install epel-release
 
16.安装php
[root@localhost tmp]# yum install --enablerepo=remi --enablerepo=remi-php56 php
17.查看php版本
[root@localhost tmp]# php -v
PHP 5.6.31 (cli) (built: Jul 6 2017 08:06:11)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
18.安装PHP扩展
18.1 安装php-fpm
[root@localhost tmp]# yum –y install --enablerepo=remi --enablerepo=remi-php56 php-fpm
18.2 安装php-mysql
[root@localhost tmp]# yum –y install --enablerepo=remi --enablerepo=remi-php56 php-mysql
 
19.nginx配置
路径:/etc/nginx/conf.d/baidu.conf
server {
listen 80;
server_name 127.0.0.1;
 
charset utf-8;
access_log /var/www/log/nginx/127.0.0.1.access.log main;
 
root /var/www/baidu;
location / {
#root /var/www/baidu;
index index.php index.html index.htm ;
try_files $uri $uri/ /index.php?$uri&$args;
 
}
 
#error_page 404 /404.html;
 
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
 
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
 
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
#root var/www/baidu;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
 
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
location ~* \.(eot|ttf|woff)$ {
add_header 'Content-Type' 'text/plain, charset=utf-8';
}
 
}
 
Nginx 网站访问入口日志
/var/www/log/nginx
20.自启动配置
查看自启动服务列表
systemctl list-unit-files|grep enabled
 
[root@localhost html]# systemctl enable nginx.service nginx自启动
[root@localhost html]# systemctl enable php-fpm.service php-fpm自启动
[root@localhost nginx]# systemctl enable mysqld.service mysql自启动
 
21.修改mysql数据库账号密码
21.1删除匿名用户
mysql> select user,host from user;
删除
mysql> delete from user where user='';
Query OK, 2 rows affected (0.00 sec)
 
set password for root@'127.0.0.1'=password('root@2017');
set password for root@'localhost'=password('root@2017');
 
创建新用户
create table temp select * from user;
update temp set user='user';
insert into user select * from temp;
flush privileges;
SET PASSWORD for 'user'@'localhost' = PASSWORD('passwd@2017');
SET PASSWORD for 'user'@'127.0.0.1' = PASSWORD('passwd@2017');
 
22.PHP配置
路径:/etc/php.ini
date.timezone =PRC 时间域
file_uploads = on ;是否允许通过HTTP上传文件的开关。默认为ON即是开
upload_tmp_dir ;文件上传至服务器上存储临时文件的地方,如果没指定就会用系统默认的临时文件夹
upload_max_filesize = 600m ;即允许上传文件大小的最大值。默认为2M
post_max_size = 500m ;指通过表单POST给PHP的所能接收的最大值,包括表单里的所有值。默认为8M
max_execution_time = 18000 ;每个PHP页面运行的最大时间值(秒),默认30秒
max_input_time = 18000 ;每个PHP页面接收数据所需的最大时间,默认60秒
memory_limit = 128m ;每个PHP页面所吃掉的最大内存,默认8M
 
 
 
23.重启服务
重启nginx
[root@localhost nginx]# systemctl restart nginx.service
重启php-fpm
[root@localhost nginx]# systemctl restart php-fpm.service
重启mysql
[root@localhost nginx]# systemctl restart mysql.service
 
24.程序权限设置
/var/www/baidu.com/session 777 session存储
/var/www/baidu.com/uploads 777 文件存储
/var/www/baidu.com/application/logs 777 程序日志
 

posted on 2019-04-08 16:17  凸逼男勃丸  阅读(232)  评论(0编辑  收藏  举报