NGINX 配置


#开启PHP


vim /usr/local/nginx/conf/nginx.conf


//server模块里添加
location ~* \.php$ {
    fastcgi_index   index.php;
    fastcgi_pass    127.0.0.1:9000;
    include         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
}

#开启https

vim /usr/local/nginx/conf/nginx.conf

//添加server模块
server {
    listen            443;
    server_name       域名;
    ssl               on;
    root              /data/www/server;
    index             index.php index.html;
    ssl_certificate      /usr/local/nginx/cert/证书.pem;
    ssl_certificate_key  /usr/local/nginx/cert/证书.key;
    ssl_session_timeout  5m;
    ssl_ciphers          ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols        TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
}

4.绑定二级域名目录

 

//添加server模块
server {
    listen      80;
    server_name 域名;
    root        根目录;
    index       index.php index.html index.htm;
}

 

 

 

.跨域

 

//server模块
location /ajax {
  proxy_pass 目标域名;
}

 

posted @ 2019-03-02 10:50  绿静風  阅读(106)  评论(0编辑  收藏  举报