nginx怎樣隱藏php

這篇文章將為大家詳細(xì)講解有關(guān)nginx怎樣隱藏php,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

創(chuàng)新互聯(lián)主營沁水網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,app開發(fā)定制,沁水h5微信小程序開發(fā)搭建,沁水網(wǎng)站營銷推廣歡迎沁水等地區(qū)企業(yè)咨詢

nginx隱藏php的方法:首先在“/usr/local/nginx/conf”下打開“nginx.conf”;然后在“service{}”中添加一段代碼為“l(fā)isten 10000 default_server...”即可。

nginx 隱藏.php后綴

在/usr/local/nginx/conf 下打開nginx.conf,在service{}添加一段代碼,

location / {
    try_files $uri $uri/ $uri.php?$args;
}
完成nginx.conf如下:
user  www www;
 
worker_processes auto;
 
error_log  /home/wwwlogs/nginx_error.log  crit;
 
pid        /usr/local/nginx/logs/nginx.pid;
 
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
 
events
    {
        use epoll;
        worker_connections 51200;
        multi_accept on;
    }
 
http
    {
        include       mime.types;
        default_type  application/octet-stream;
 
        server_names_hash_bucket_size 128;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
        client_max_body_size 50m;
 
        sendfile   on;
        tcp_nopush on;
 
        keepalive_timeout 60;
 
        tcp_nodelay on;
 
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 64k;
        fastcgi_buffers 4 64k;
        fastcgi_busy_buffers_size 128k;
        fastcgi_temp_file_write_size 256k;
 
        gzip on;
        gzip_min_length  1k;
        gzip_buffers     4 16k;
        gzip_http_version 1.1;
        gzip_comp_level 2;
        gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
        gzip_vary on;
        gzip_proxied   expired no-cache no-store private auth;
        gzip_disable   "MSIE [1-6]\.";
 
        #limit_conn_zone $binary_remote_addr zone=perip:10m;
        ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.
 
        server_tokens off;
        access_log off;
 
    
server
    {
        listen 10000 default_server;
        #listen [::]:80 default_server ipv6only=on;
        server_name _;
        index index.html index.htm index.php;
        root  /home/wwwroot/default/src;
 
        #error_page   404   /404.html;
 
        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
 
        include enable-php.conf;
 
        location /nginx_status
        {
            stub_status on;
            access_log   off;
        }
 
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }
 
        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }
 
        location ~ /.well-known {
            allow all;
        }
 
        location ~ /\.
        {
            deny all;
        }
        location / {
            try_files $uri $uri/ $uri.php?$args;
        }
 
 
        access_log  /home/wwwlogs/access.log;
    }
include vhost/*.conf;
}

關(guān)于nginx怎樣隱藏php就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

本文題目:nginx怎樣隱藏php
當(dāng)前網(wǎng)址:http://bm7419.com/article32/ijpisc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計公司定制網(wǎng)站、微信小程序、靜態(tài)網(wǎng)站、網(wǎng)站維護、用戶體驗

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運營