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
改动服务的默认启动等级。
版权声明:本文博客原创文章,博客,未经同意,不得转载。
CentOS在安装配置 Ngnix_tomcat_PHP_Mysql的更多相关文章
- Centos下安装配置LAMP(Linux+Apache+MySQL+PHP)
Centos下安装配置LAMP(Linux+Apache+MySQL+PHP) 关于LAMP的各种知识,还请大家自行百度谷歌,在这里就不详细的介绍了,今天主要是介绍一下在Centos下安装,搭建一 ...
- CentOS 7安装配置Apache HTTP Server
原文 CentOS 7安装配置Apache HTTP Server RPM安装httpd # yum -yinstall httpd //安装httpd会自动安装一下依赖包: apr apr-ut ...
- CentOS 7 安装配置 NFS
CentOS 7 安装配置 NFS 环境 nps 192.168.1.97 client 192.168.1.98 一.yum 安装 yum -y install nfs-utils rpcbind ...
- 分布式文件系统 FastDFS 5.0.5 & Linux CentOS 7 安装配置(单点安装)——第一篇
分布式文件系统 FastDFS 5.0.5 & Linux CentOS 7 安装配置(单点安装)--第一篇 简介 首先简单了解一下基础概念,FastDFS是一个开源的轻量级分布式文件系统,由 ...
- CentOS 7安装配置Samba服务器
CentOS 7安装配置Samba服务器 CentOS 7下Samba服务器安装配置过程笔记. 假设我们有这样一个场景 共享名 路径 权限 SHAREDOC /smb/docs 所有人员包括来宾均可以 ...
- CentOS 7安装配置Samba服务器(挂载共享文件夹)
CentOS 7安装配置Samba服务器 CentOS 7下Samba服务器安装配置过程笔记. 假设我们有这样一个场景 共享名 路径 权限 SHAREDOC /smb/docs 所有人员包括来宾均可以 ...
- 记录:CentOS 7 安装配置分布式文件系统 FastDFS 5.1.1
CentOS 7 安装配置分布式文件系统 FastDFS 5.1.1 软件下载:http://download.csdn.net/download/qingchunwuxian1993/9897458 ...
- CentOS gitlab 安装配置
CentOS gitlab 安装配置 2018-11-02 11:23:09 Visit 5 在/etc/yum.repos.d 目录下创建文件gitlab-ce.repo,使用国内的安装源 b ...
- <转>CentOS 7 安装配置 NFS
CentOS 7 安装配置 NFS 环境 nps 192.168.1.97 client 192.168.1.98 一.yum 安装 yum -y install nfs-utils rpcbind ...
随机推荐
- 手机装linux系统
第一步: 首先 , 你的手机需要获取root权限. 如果不知道如何获取, 可以到电脑上搜索一下安卓手机root教程. 不同品牌的手机root的方法不同. 也可以到机锋论坛上寻找root的具体方法. 第 ...
- C++ Primer笔记7_STL之关联容器
关联容器 与顺序容器不同,关联容器的元素是按keyword来訪问和保存的.而顺序容器中的元素是按他们在容器中的位置来顺序保存的. 关联容器最常见的是map.set.multimap.multiset ...
- 抽出SqlHelper
什么叫SqlHelper,通过简单的翻译,能够获得这是对Sql的帮助,那么它究竟对我们的Sql做出了什么样的帮助呢? 在一款软件的设计编程中,总是会对数据库有连接的.假设你用的是SqlServer的数 ...
- Harris角点检测算原理
主要参考了:http://blog.csdn.net/yudingjun0611/article/details/7991601 Harris角点检测算子 本文将该文拷贝了过来,并做了一些数学方面的 ...
- Max Sum (hdu 1003 简单DP水过)
Max Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Su ...
- AJAX POST请求中參数以form data和request payload形式在servlet中的获取方式
HTTP请求中,假设是get请求,那么表单參数以name=value&name1=value1的形式附到url的后面,假设是post请求,那么表单參数是在请求体中,也是以name=value& ...
- java获取当前日期时间代码总结
1.获取当前时间,和某个时间进行比较.此时主要拿long型的时间值. 方法如下: 要使用 java.util.Date .获取当前时间的代码如下 代码如下 复制代码 Date date = new ...
- hdu 4465 Candy(2012 ACM-ICPC 成都现场赛)
简单概率题,可以直接由剩余n个递推到剩余0个.现在考虑剩余x个概率为(1-p)的candy时,概率为C(2 * n - x, x) * pow(p, n + 1) *pow(1 - p, n - x ...
- IOS应用程序生命周期详解
第一. IOS应用程序的五种状态: 1. Not running:应用还没有启动,或者应用正在运行但是途中被系统停止. 2. Inactive:当前应用正在前台运行,但是并不接收事件(当前或许正在执行 ...
- Git双机同步
如果使用git init 初始化,当客户端仓库push内容时,服务器端仓库可以看到log,但是更新的文件不能显示,必须使用git reset --hard才能更新内容