阿里云centos6.9 搭建 nginx+mysql+php 环境+https部署源码到网站正式访问修改版

释放双眼,带上耳机,听听看~!
  1. yum -y update
  2. yum -y install mysql-server mysql-devel nginx
  3. service mysqld start
  4. mysqladmin -u root password ‘new-password’
  5. service mysqld restart
  6. mysql -uroot -p (进入mysql)
  7. use mysql
  8. update user set host='%',password=password('xjm199932') where host='127.0.0.1';
  9. quit
  10. service mysqld restart
  11. rpm -Uvh http://download.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  12. rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
  13. yum install -y --enablerepo=remi,remi-php56 php php-opcache php-pecl-apcu php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process php-gd php-common
  14. service php-fpm start
  15. rm -rf /etc/nginx/conf.d/default.conf
  16. vim /etc/nginx/conf.d/default.conf (填入代码)
    #
    # The default server
    #
    
    server {  
        listen       80 default_server;
    #   listen       [::]:80 default_server;
        server_name  _; 
        rewrite ^(.*) https://$host$1 permanent;
        root         /usr/share/nginx/html;
        index        index.html index.htm index.php;
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;
        
        location / {
        }
    
        location ~ .php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
             include fastcgi_params;
         }
    
        error_page 404 /404.html;
            location = /40x.html {
        }
    
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    
    }
    
    
    
    1. rm -rf /etc/nginx/conf.d/ssl.conf
    2. vim /etc/nginx/conf.d/ssl.conf(填入如下代码)
      # HTTPS server configuration
      
      server {
          listen       443 ssl http2 default_server;
      #    listen       [::]:443 ssl;
          server_name  _;
          root         /usr/share/nginx/html;
          ssl on;
          index        index.html index.htm index.php;
      
          ssl_certificate cert.pem;
          ssl_certificate_key cert.key;
          ssl_session_cache shared:SSL:1m;
          ssl_session_timeout  10m;
          ssl_ciphers HIGH:!aNULL:!MD5;
          ssl_prefer_server_ciphers on;
      
          # Load configuration files for the default server block.
          include /etc/nginx/default.d/*.conf;
      
          location / {
          } 
      
           location ~ .php$ {
              fastcgi_pass 127.0.0.1:9000;
              fastcgi_index index.php;
              fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
              include fastcgi_params;
           }
      
          error_page 404 /404.html;
              location = /40x.html {
          }
      
          error_page 500 502 503 504 /50x.html;
              location = /50x.html {
          }
      }
      
    3. 把nginx证书改名为cert.pem 和cert.key,上传到/etc/nginx
    4. service nginx start
    5. 完成

给TA买糖
共{{data.count}}人
人已赞赏
教程

问道手游-MT3换皮梦幻充值语句

2020-9-29 0:48:42

教程

阿里云centos6.9 搭建 apache+mysql+php 环境+部署源码到网站正式访问

2020-11-17 8:47:55

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索