Last active
March 6, 2018 07:40
-
-
Save georgebent/d9a7aaf44d8ccaf6bc8bde885b838ee7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /etc/nginx/sites-available/ | |
sudo touch new.site.conf | |
sudo nano new.site.conf | |
cd ../sites-enabled | |
sudo ln -s ../sites-available/new.site.conf . | |
sudo mcedit /etc/hosts | |
sudo nginx -t | |
sudo systemctl reload nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name test.loc www.test.loc; | |
root /home/yura/projects/test.loc; | |
index index.php index.html; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
location ~ \.php$ { | |
fastcgi_pass unix:/run/php/php7.1-fpm.sock; | |
include snippets/fastcgi-php.conf; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name phpmyadmin.loc www.phpmyadmin.loc; | |
root /usr/share/phpmyadmin; | |
index index.php; | |
location / { | |
try_files $uri $uri/ =404; | |
} | |
location ~ \.php$ { | |
fastcgi_pass unix:/run/php/php7.1-fpm.sock; | |
include snippets/fastcgi-php.conf; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name www.test.loc; | |
return 301 $scheme://test.loc$request_uri; | |
} | |
server { | |
listen 80; | |
listen [::]:80; | |
root /home/yura/projects/test.loc; | |
index index.html index.php; | |
server_name test.loc; | |
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; } | |
location ~ \.php$ { | |
try_files $uri = 404; | |
include fastcgi_params; | |
fastcgi_pass unix:/run/php/php7.1-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} | |
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ { | |
expires 14d; | |
add_header Cache-Control "public"; | |
open_file_cache max=20000 inactive=20s; | |
open_file_cache_valid 30s; | |
} | |
gzip on; | |
gzip_proxied any; | |
gzip_comp_level 5; | |
gzip_types image/svg+xml text/plain text/xml application/xml application/javascript application/x-javascript text/jav$; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment