apache配置防盗链,切换php版本

发布于:2020-03-29 21:46:11
<VirtualHost *:80>
    ServerAdmin webmaster@example.com
    DocumentRoot "/www/wwwroot/dfdfdfdf.wang/public"
    ServerName 9f669fe3.lailang.wang
    ServerAlias dfdf.wang www.dfdfdf.wang
    errorDocument 404 /404.html
    ErrorLog "/www/wwwlogs/lailang.wang-error_log"
    CustomLog "/www/wwwlogs/lailang.wang-access_log" combined
    #HTTP_TO_HTTPS_START
    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteCond %{SERVER_PORT} !^443$
        RewriteRule (.*) https://%{SERVER_NAME}$1 [L,R=301]
    </IfModule>
    #HTTP_TO_HTTPS_END
    
    #DENY FILES
     <Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
       Order allow,deny
       Deny from all
    </Files>
    
    #PHP
    <FilesMatch \.php$>
            SetHandler "proxy:unix:/tmp/php-cgi-70.sock|fcgi://localhost"
    </FilesMatch>
    
    #PATH
    <Directory "/www/wwwroot/dingou.wang/public">
        SetOutputFilter DEFLATE
        Options FollowSymLinks
        AllowOverride All
        Require all granted
        DirectoryIndex index.php index.html index.htm default.php default.html default.htm
    </Directory>
</VirtualHost>

<VirtualHost *:443>
    ServerAdmin webmasterexample.com
    DocumentRoot "/www/wwwroot/dfdf.wang/public"
    ServerName SSL.dfdf.wang
    ServerAlias lailang.wang dfdf.lailang.wang 
    errorDocument 404 /404.html
    ErrorLog "/www/wwwlogs/dfdf.wang-error_log"
    CustomLog "/www/wwwlogs/dfdf.wang-access_log" combined
    
    #SSL
    SSLEngine On
    SSLCertificateFile /etc/letsencrypt/live/lailang.wang/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/lailang.wang/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/dingou.wang/1_root_bundle.crt
    SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
    SSLProtocol All -SSLv2 -SSLv3
    SSLHonorCipherOrder On
    
    #PHP
    <FilesMatch \.php$>
            SetHandler "proxy:unix:/tmp/php-cgi-70.sock|fcgi://localhost"
    </FilesMatch>
    
    
    #DENY FILES
     <Files ~ (\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)$>
       Order allow,deny
       Deny from all
    </Files>
    
    #PATH
    <Directory "/www/wwwroot/dfdf.wang/public">
        SetOutputFilter DEFLATE
        Options FollowSymLinks
        AllowOverride All
        Require all granted
        DirectoryIndex index.php index.html index.htm default.php default.html default.htm
    </Directory>


阅读 121