apache常用配置

apache默认配置

<VirtualHost *:80>
    Header set Access-Control-Allow-Origin *
    Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
    Header always set Access-Control-Max-Age "1000"        
    Header always set Access-Control-Allow-Headers "User-Channel, token, x-requested-with, Content-Type, origin, authorization, accept, client-security-token"        
    ServerName  demo.cn        
    DocumentRoot /var/www/html/01/demo/web        
    SetEnv APPLICATION_ENV "development"        
    <Directory "/var/www/html/01/demo/web">                
        DirectoryIndex index.php index.html                
        AllowOverride All
        Order allow,deny                
        Allow from all        
    </Directory>        
    ErrorLog ${APACHE_LOG_DIR}/error.log        
    CustomLog ${APACHE_LOG_DIR}/access.log combined    

    SSLEngine on
    SSLProtocol all -SSLv2 -SSLv3
    SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM
</VirtualHost>

配置ssl

<VirtualHost *:443>
    Header set Access-Control-Allow-Origin *
    Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
    Header always set Access-Control-Max-Age "1000"        
    Header always set Access-Control-Allow-Headers "User-Channel, token, x-requested-with, Content-Type, origin, authorization, accept, client-security-token"        
    ServerName  demo.cn        
    DocumentRoot /var/www/html/01/demo/web        
    SetEnv APPLICATION_ENV "development"        
    <Directory "/var/www/html/01/demo/web">                
        DirectoryIndex index.php index.html                
        AllowOverride All
        Order allow,deny                
        Allow from all        
    </Directory>        
    ErrorLog ${APACHE_LOG_DIR}/error.log        
    CustomLog ${APACHE_LOG_DIR}/access.log combined    

    SSLEngine on
    SSLProtocol all -SSLv2 -SSLv3
    SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM
    SSLHonorCipherOrder on
    SSLCertificateFile /etc/ssl/test/test.cn_public.crt
    SSLCertificateKeyFile /etc/ssl/test/test.cn.key
    SSLCertificateChainFile  /etc/ssl/test/test.cn_chain.crt
</VirtualHost>

 apache操作

重启

/etc/init.d/apache2 restart

启动

/etc/init.d/apache2 start

关闭

/etc/init.d/apache2 stop

 

未完待续

posted @ 2020-05-12 09:34  jiuchen  阅读(329)  评论(0)    收藏  举报