Alias Nginx beda Directory Root

The location directive matches against the uri in the request. The root directive and alias directives are both used to indicate where in the filesystem to serve resources from, the difference being that when using root, the entire URI is still appended to the root; whereas when using alias, the location part is dropped.


######################## vhost.conf
 location /Trijulian24 {                #Trijulian24 merupakan nama Directory root      
 index  index.php index.html index.htm;    
 root  /usr/share;                      #Directory Alias asli  =  /usr/share/Trijulian24
try_files $uri $uri/ =404;

allow all;

 access_log on;
    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    }
}
Posted on: August 29, 2020, by :