Skip to content

Instantly share code, notes, and snippets.

@nguyenhiepvan
Last active October 26, 2020 05:45
Show Gist options
  • Save nguyenhiepvan/b4b85234df93df9f7447ebd05c592330 to your computer and use it in GitHub Desktop.
Save nguyenhiepvan/b4b85234df93df9f7447ebd05c592330 to your computer and use it in GitHub Desktop.
Automation vitural host laravel
UseCanonicalName Off
<VirtualHost *:80>
ServerName vhosts.fqdn
ServerAlias *.local.com
VirtualDocumentRoot /var/www/laravel/%1/public
<Directory ~ "/var/www/laralve/%1/public">
Options Indexes FollowSymlinks MultiViews
AllowOverride All
Require all granted
<FilesMatch "\.php$">
Require all granted
SetHandler proxy:fcgi://127.0.0.1:9000
</FilesMatch>
</Directory>
</VirtualHost>
server {
listen 80;
listen [::]:80;
server_name ~^(www\.)?(?<sname>.+?).local.com$;
root /var/www/laravel/$sname/public;
index index.php index.html index.htm;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log /var/log/nginx/$sname-access.log;
error_log /var/log/nginx/laravel-default-error.log debug;
error_page 404 /index.php;
sendfile off;
# Remove trailing slash to please routing system.
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
@idist-hn
Copy link

 location ~ /\.ht {
        deny all;
    }

cái này mà muốn để uri dạng abc.html là chết nè

@vuthaihoc
Copy link

 location ~ /\.ht {
        deny all;
    }

cái này mà muốn để uri dạng abc.html là chết nè

/.ht chỉ nhận /.htaccess /.http ... chứ ko nhận /index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment