ubuntu+php+apache2+nginx

//删除 php
sudo dpkg -l | grep php
sudo apt-get autoremove php7*
sudo find /etc -name "*php*" |xargs  rm -rf
sudo apt purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
//检查有没有清理干净
sudo dpkg -l | grep php

//安装 php7.1
apt-add-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php7.1-fpm php7.1-mcrypt php7.1-cli php7.1-xml php7.1-mysql php7.1-gd php7.1-imagick php7.1-recode php7.1-tidy php7.1-xmlrpc
sudo apt-get install php7.1-curl
sudo apt-get install php7.1-mysql

//安装apache2
sudo apt-get update
sudo apt-get install apache2

// apache2支持php
sudo apt-get update
sudo apt-get install libapache2-mod-php7.1
sudo a2enmod rewrite

// apache2 开启 ssl
sudo apt-get update
sudo apt-get install openssl
sudo a2enmod ssl

a2ensite default-ssl.conf


//apache2 配置

#/etc/apache2/apache2.conf
//添加
<Directory />
    Options FollowSymLinks
    AllowOverride All
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride All
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

<Directory /var/www/html/laravel5>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
    Order allow,deny
    Allow from all
</Directory>

#/etc/apache2/sites-available/000-default.conf

    DocumentRoot "/var/www/html/laravel5/public"
    <Directory /var/www/html/laravel5>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>


#/etc/apache2/sites-available/default-ssl.conf

ServerName  detault_server:443
DocumentRoot /var/www/html/laravel5/public

SSLCertificateFile /etc/apache2/cert/1702986_s3.atjubo.com_public.crt
#将/etc/apache2/www.YourDomainName.com_public.crt替换为证书文件路径+证书文件名。
SSLCertificateKeyFile /etc/apache2/cert/1702986_s3.atjubo.com.key
#将/etc/apache2/www.YourDomainName.com.key替换为证书秘钥文件路径+证书秘钥文件名。
SSLCertificateChainFile /etc/apache2/cert/1702986_s3.atjubo.com_chain.crt
#将/etc/apache2/www.YourDomainName.com_chain.crt替换为证书链文件路径+证书链文件名。


# /etc/apache2/ports.conf
Listen 443 https

// 检查Apache2 配置
apache2ctl configtest

// apache2 重启
sudo /etc/init.d/apache2 restart

// apache2 卸载
sudo apt-get --purge remove apache-common
sudo apt-get remove apache*
sudo find /etc -name "*apache*" |xargs  rm -rf
sudo rm -rf /etc/libapache2-mod-jk
dpkg -l |grep apache2|awk '{print $2}'|xargs dpkg -P

//安装nginx
sudo apt-get update
sudo apt-get install nginx

//nginx https proxy
#/etc/nginx/sites-available/default
        listen 443;
         server_name default_server; #填写绑定证书的域名
         ssl on;
         ssl_certificate /etc/nginx/cert/1702986_s3.atjubo.com.pem;
         ssl_certificate_key /etc/nginx/cert/1702986_s3.atjubo.com.key;
         ssl_session_timeout 5m;
         ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
         ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
        ssl_prefer_server_ciphers on;

    location /ng/ {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        #try_files $uri $uri/ =404;

        proxy_pass http://localhost:9090/;

    }


    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        #try_files $uri $uri/ =404;
        #proxy_set_header X-Real-IP $remote_addr;
          #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          #proxy_set_header Host $http_host;
         #proxy_set_header X-NginX-Proxy true;
         #proxy_redirect off;
      proxy_pass http://localhost:8080/;
    }

// 检查 nginx 配置
nginx -t

// 卸载nginx

    sudo apt-get remove nginx nginx-common # 卸载删除除了配置文件以外的所有文件。

    sudo apt-get purge nginx nginx-common # 卸载所有东东,包括删除配置文件。

    sudo apt-get autoremove # 在上面命令结束后执行,主要是卸载删除Nginx的不再被使用的依赖包。

    sudo apt-get remove nginx-full nginx-common #卸载删除两个主要的包。

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值