CentOS在安装配置 Ngnix_tomcat_PHP_Mysql
安装Nginx
yum install nginx
假设显示找不到 nginx包,新建一个文件/etc/yum.repos.d/nginx.repo,内容:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1
当中:OS替换成centos或者rhel,依据你安装的发行版版本号 OSRELEASE替换成5,6或者7,分别相应着5.想,6.x,7.x
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
~
删除之前的httpd
yum remove httpd
安装
yum install ngnix
/usr/sbin/nginx -t
安装PHP
yum install php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy
vi /etc/php.ini
在文件末尾加入cgi.fix_pathinfo = 1
service php-fpm start
php-fpm增加启动项:
chkconfig --levels 235 php-fpm on
安装Tomcat
安装mysql:
mysql>use mysql;
mysql>update user set password=password('你的密码') where user='root';
mysql>flush privileges;
grant all on *.* to 'root'@'localhost' IDENTIFIED BY '你的password'with grant option ;
flush privileges
配置Nginx:
进入/etc/nginx
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
进入:/etc/nginx/conf.d
server {listen 8080;server_name localhost;#charset koi8-r;#access_log /var/log/nginx/log/host.access.log main;location / {#root /usr/share/nginx/html;index index.html index.htm;proxy_pass http://127.0.0.1:8090/;}#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 html;# fastcgi_pass 127.0.0.1:9000;# fastcgi_index index.php;# fastcgi_param SCRIPT_FILENAME /scripts$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;#}
}
nginx配置完毕
server {listen 80;server_name localhost;#charset koi8-r;#access_log /var/log/nginx/log/host.access.log main;location / {#root /usr/share/nginx/html;root /var/www/html;index index.html index.htm;}#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 html;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.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;#}
}
chkconfig 使用范例:
chkconfig --list #列出全部的系统服务
chkconfig --add httpd #添加httpd服务
chkconfig --del httpd #删除httpd服务
chkconfig --level httpd 2345 on #设置httpd在执行级别为2、3、4、5的情况下都是on(开启)的状态
chkconfig --list #列出系统全部的服务启动情况
chkconfig --list mysqld #列出mysqld服务设置情况
chkconfig --level 35 mysqld on #设定mysqld在等级3和5为开机执行服务,--level 35表示操作仅仅在等级3和5执行。on表示启动,off表示关闭
chkconfig mysqld on #设定mysqld在各等级为on,“各等级”包含2、3、4、5等级
怎样添加一个服务:
1.服务脚本必须存放在/etc/ini.d/文件夹下。
2.chkconfig --add servicename
在chkconfig工具服务列表中添加此服务,此时服务会被在/etc/rc.d/rcN.d中赋予K/S入口了;
3.chkconfig --level 35 mysqld on
改动服务的默认启动等级。
版权声明:本文博客原创文章,博客,未经同意,不得转载。
转载于:https://www.cnblogs.com/blfshiye/p/4622882.html
CentOS在安装配置 Ngnix_tomcat_PHP_Mysql相关推荐
- Centos 6 安装 配置 oracle11g R2
Centos 6 安装 配置 oracle11g R2 分享到:0 分类: Linux&CentosOracle 1.安装centos6.3_ ...
- CentOS 7 安装配置 NFS
CentOS 7 安装配置 NFS 环境 nps 192.168.1.97 client 192.168.1.98 一.yum 安装 yum -y install nfs-utils rpcbind ...
- Linux 实操———CentOS 6 安装配置 Tomcat
引言 Linux下安装Tomcat. 一.下载.传输与解压 同<Linux 实操---CentOS 6 安装配置 Oracle JDK 1.8>一样,前期都是先在远程机上下载压缩包,然后通 ...
- centos 7安装配置python3.7
centos 7安装配置python3.7(亲测) 默认版本为python2.7 (1)下载python版本 wget https://www.python.org/ftp/python/3.7.3/ ...
- centos 一键安装配置nginx脚本
centos 一键安装配置nginx脚本 installNginx.ssh 用vi或则vim编辑 installNginx.ssh #!/bin/bash # author:kwin # Email: ...
- centos+ffmpeg安装配置+切片
在虚拟机vmware6(版本比较旧了)中,安装centos6,不多说了. vmware虚拟工具安装前,需要安装如下内容 yum -y install kernel-devel yum -y insta ...
- 在CentOS下安装配置MySQL(转)
今天刚把项目做完,需要马上部署到新到的测试服务器上,于是乎,要在服务器上安装环境,由于好久在linux上部署了,手有些生,比较费劲装完,现在把重要步骤贴出,供自己以后参照. 1.首先要看看有没有已经安 ...
- centos编译安装配置支持ssl加密的mysql replication
参考文章:http://www.howtoforge.com/how-to-set-up-mysql-database-replication-with-ssl-encryption-on-cento ...
- CentOS 7 安装 配置 Nginx + PHP
1. CentOS 7 下配置 yum 安装 Nginx. 进入/etc/yum.repos.d/目录下创建一个源配置文件nginx.repo: cd /etc/yum.repos.d/ vim ng ...
最新文章
- 多视觉任务的全能: HRNet
- 命令行接口(CLI)将被取而代之,它不再是网络运维的主要工具
- 【廖雪峰python进阶笔记】类的继承
- python入门教程非常详细-Python 基础教程
- express+nodecoffee写passport登录验证实例(一)
- python-extend用法
- html手机编辑器新手,HTML 编辑器
- 工作态度决定了工作结果
- 大学如何学习——我的五年失败经验总结
- 短信网关平台选型推荐
- 兄弟单词C语言,brother是什么意思
- 海康摄像头恢复出厂监控录像视频恢复
- Oracle转换MySql之递归start with
- aspen和python一起使用_aspen plus 能不能用python
- 微软软件测试报告,windows计算器软件测试报告.doc
- BoneWeb环境搭建 创建应用
- 金山员工猝死:莫让青春负重前行
- 持续有效的风险指标:动荡指数
- 论文翻译 Deep Steering: Learning End-to-End Driving Model from Spatial and Temporal Visual Cues
- 游戏测试需要学什么软件有哪些内容,除了会玩游戏之外,作为游戏测试还需要具备哪些“技能”?...