yum安装php及nginx

环境安装流程及注意事

 
  1. php相关环境安装以及注意事项

安装nginx

 
  1. yum install yum-priorities -y
  2. wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
  3. rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
  4. yum install nginx
  5.  
  6. systemctl start nginx.service #启动nginx
  7. systemctl stop nginx.service #停止
  8. systemctl restart nginx.service #重启
  9. systemctl enable nginx.service #设置开机启动

安装php

 
  1. 检查当前安装的PHP包 yum list installed | grep php,如果有安装的PHP包,先删除他们, 如: yum remove php.x86_64 php-cli.x86_64 php-common.x86_64

配置安装包源:

 
  1. # Centos 5.X
  2. rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
  3. # CentOs 6.x
  4. rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
  5. # CentOs 7.X
  6. rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
  7. rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

执行安装

 
  1. yum -y install php56w.x86_64
  2. yum -y --enablerepo=webtatic install php56w-devel
  3. yum -y install php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 php56w-opcache.x86_64

安装PHP FPM

 
  1. yum -y install php56w-fpm
  2. #设置php-fpm开机启动
  3. chkconfig php-fpm on
  4. #启动php-fpm
  5. /etc/init.d/php-fpm start | service php-fpm start | service php5-fpm start

 

配置nginx配置文件

server{
    listen       80;
    server_name  www.baidu.com;#项目域名
    root  /home/wwwroot/;#项目地址
    index index.php index.html index.htm;
       

    gzip on;
    gzip_min_length  3k;
    gzip_buffers     4 16k;
    #gzip_http_version 1.0;
    gzip_comp_level 5;
    gzip_types       text/plain application/javascript  application/x-javascript text/css  text/javascript font/woff2 image/x-icon  image/jpeg image/gif image/png;
    gzip_vary on;



         location ~ \.php/?.* {  
      
                root  /home/wwwroot/;#项目地址  
      
                fastcgi_pass   127.0.0.1:9000;  
      
                 fastcgi_index  index.php;  
      
                 fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;  
      
                include        fastcgi_params;  
      
                #定义变量 $path_info ,用于存放pathinfo信息  
      
                 set $path_info "";  
      
                 #定义变量 $real_script_name,用于存放真实地址  
      
                 set $real_script_name $fastcgi_script_name;  
      
                 #如果地址与引号内的正则表达式匹配  
      
                 if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {  
      
                         #将文件地址赋值给变量 $real_script_name  
      
                         set $real_script_name $1;  
      
                         #将文件地址后的参数赋值给变量 $path_info  
      
                         set $path_info $2;  
      
                 }  
      
                 #配置fastcgi的一些参数  
      
                 fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;  
      
                 fastcgi_param SCRIPT_NAME $real_script_name;  
      
                 fastcgi_param PATH_INFO $path_info;  
      
             }  

   location ~.*\.(js|css|html|png|jpg)$
   {
      expires    3d;
   }


    location / {
#        try_files $uri $uri/ /index.php?$query_string;
            if (!-e $request_filename) {
                rewrite  ^(.*)$  /index.php?s=/$1  last;
            }
    }
}

 

java环境安装流程及注意事项

 
  1. 环境配置:
  2. 安装jdk环境,版本1.8,liunx版本;
  3. 步骤一:查看现有安装的JDK版本 rpm -qa|grep -i java
  4. 步骤二:卸载已有软件(若服务器已安装) rpm -e --nodeps ****
  5. 步骤三:解压JDK tar -zxvf jdk版本
  6. 步骤四:将jdk移动到“/usr/src/jdk”目录下
  7. 步骤五:配置系统环境变量
  8. export JAVA_HOME=/usr/src/jdk/jdk1.8
  9. export PATH=$JAVA_HOME/bin:$PATH
  10. 步骤六:使配置文件生效,并测试
  11. source /etc/profile
  12. java -version
  13. 项目部署:
  14. 1.将项目maven install运行,生产一个jar;
  15. 2.将生成的jar包上传到服务器/opt/dd_interface目录下;
  16. 3.通过命令:java -jar 项目名 ,启动该项目;
  17. 4.查看,监控项目运行情况

你可能感兴趣的:(php)