Last active
March 2, 2022 17:14
-
-
Save smarteist/413dda8287c80fc1fa32535964e23024 to your computer and use it in GitHub Desktop.
This is a local webserver configuration for nginx on LEMP stack plus phpmyadmin.
This file contains hidden or 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; | |
| listen [::]:80; | |
| #listen 443 ssl http2; | |
| server_name localhost .localhost; | |
| charset utf-8; | |
| root "/srv/www/nginx/"; | |
| index index.php index.html index.htm; | |
| gzip off; | |
| location / { | |
| autoindex on; | |
| autoindex_exact_size off; | |
| autoindex_format html; | |
| autoindex_localtime on; | |
| } | |
| # ------------------- | |
| # PHPMYADMIN CONF | |
| # ------------------- | |
| location ^~ /phpmyadmin { | |
| alias /usr/share/webapps/phpMyAdmin; | |
| index index.php index.html index.htm; | |
| try_files $uri $uri/ @phpmyadmin; | |
| location ~ \.php$ { | |
| fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
| fastcgi_pass unix:/run/php-fpm7/php-fpm.sock; | |
| fastcgi_index index.php; | |
| include fastcgi.conf; | |
| fastcgi_param SCRIPT_FILENAME $request_filename; | |
| } | |
| } | |
| location @phpmyadmin{ | |
| rewrite /phpmyadmin/(.*)$ /usr/share/webapps/phpMyAdmin/index.php?/$1 last; | |
| } | |
| # ------------------- | |
| # END OF PHPMYADMIN CONF | |
| # ------------------- | |
| } | |
| # ------------------- | |
| # LARAVEL CONF | |
| # ------------------- | |
| server { | |
| listen 80; | |
| listen [::]:80; | |
| #listen 443 ssl http2; | |
| server_name laravel.localhost; | |
| charset utf-8; | |
| root "/srv/www/nginx/laravel/public"; | |
| index index.php index.html index.htm; | |
| gzip off; | |
| #ssl_certificate /etc/nginx/ssl/dev.localhost.crt; | |
| #ssl_certificate_key /etc/nginx/ssl/dev.localhost.key; | |
| # RESTRICTIONS | |
| location ~* /(?:uploads|files)/.*\.php$ { | |
| deny all; | |
| } | |
| location ~ /\.ht { | |
| deny all; | |
| } | |
| location = /favicon.ico { access_log off; log_not_found off; } | |
| location = /robots.txt { access_log off; log_not_found off; } | |
| location / { | |
| autoindex on; | |
| autoindex_exact_size off; | |
| autoindex_format html; | |
| autoindex_localtime on; | |
| try_files $uri $uri/ /index.php?$args; | |
| } | |
| # Pass all .php files onto a php-fpm or php-cgi server | |
| # NOTE: You should have "cgi.fix_pathinfo = 0;" in /etc/php#/php-fpm/php.ini | |
| location ~ \.php$ { | |
| try_files $uri =404; | |
| include fastcgi.conf; | |
| fastcgi_read_timeout 3600s; | |
| fastcgi_buffer_size 128k; | |
| fastcgi_buffers 4 128k; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| fastcgi_pass unix:/run/php-fpm7/php-fpm.sock; | |
| fastcgi_index index.php; | |
| } | |
| location ~* ^.+.(js|css|png|jpg|jpeg|gif|bmp|rtf|ico|html|xml|woff|woff2|ttf|svg|svgz|eot|otf|rss|zip|rar|bz2|wav|mp4|mp3|ogg)$ { | |
| add_header Access-Control-Allow-Origin *; | |
| access_log off; | |
| log_not_found off; | |
| expires 365d; | |
| } | |
| } | |
| # ------------------- | |
| # END OF LARAVEL CONF | |
| # ------------------- | |
| # ------------------- | |
| # TRELLIS CONF | |
| # ------------------- | |
| server { | |
| listen 80; | |
| listen [::]:80; | |
| server_name trellis.localhost; | |
| root "/srv/www/nginx/trellis/site/web/"; | |
| # Default file | |
| index index.php; | |
| location / { | |
| try_files $uri $uri/ /index.php?$args; | |
| } | |
| # Add a slash at the end of request */wp-admin | |
| rewrite /wp-admin$ $scheme://$host$uri/ permanent; | |
| # Deny files starting with a . (dot) | |
| location ~ /\. { | |
| deny all; | |
| } | |
| # PHP handling with FPM | |
| location ~ \.php$ { | |
| try_files $uri =404; | |
| fastcgi_pass unix:/run/php-fpm7/php-fpm.sock; | |
| fastcgi_index index.php; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| include fastcgi_params; | |
| } | |
| location ~* ^.+.(js|css|png|jpg|jpeg|gif|bmp|rtf|ico|html|xml|woff|woff2|ttf|svg|svgz|eot|otf|rss|zip|rar|bz2|wav|mp4|mp3|ogg)$ { | |
| add_header Access-Control-Allow-Origin *; | |
| access_log off; | |
| log_not_found off; | |
| expires 365d; | |
| } | |
| } | |
| # ------------------- | |
| # END OF TRELLIS CONF | |
| # ------------------- | |
| # ------------------- | |
| # WORDPRESS CONF | |
| # ------------------- | |
| server { | |
| listen 80; | |
| listen [::]:80; | |
| server_name wp.localhost; | |
| root "/srv/www/nginx/wordpress"; | |
| # Default file | |
| index index.php; | |
| location / { | |
| try_files $uri $uri/ /index.php?$args; | |
| } | |
| # Add a slash at the end of request */wp-admin | |
| rewrite /wp-admin$ $scheme://$host$uri/ permanent; | |
| # Deny files starting with a . (dot) | |
| location ~ /\. { | |
| deny all; | |
| } | |
| # PHP handling with FPM | |
| location ~ \.php$ { | |
| try_files $uri =404; | |
| fastcgi_pass unix:/run/php-fpm7/php-fpm.sock; | |
| fastcgi_index index.php; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| include fastcgi_params; | |
| } | |
| location ~* ^.+.(js|css|png|jpg|jpeg|gif|bmp|rtf|ico|html|xml|woff|woff2|ttf|svg|svgz|eot|otf|rss|zip|rar|bz2|wav|mp4|mp3|ogg)$ { | |
| add_header Access-Control-Allow-Origin *; | |
| access_log off; | |
| log_not_found off; | |
| expires 365d; | |
| } | |
| } | |
| # ------------------- | |
| # END OF WORDPRESS CONF | |
| # ------------------- |
This file contains hidden or 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
| #user html; | |
| worker_processes 1; | |
| #error_log logs/error.log; | |
| #error_log logs/error.log notice; | |
| #error_log logs/error.log info; | |
| include /etc/nginx/modules-enabled/*.conf; | |
| #pid logs/nginx.pid; | |
| events { | |
| worker_connections 1024; | |
| } | |
| http { | |
| ## | |
| # Basic Settings | |
| ## | |
| sendfile on; | |
| tcp_nopush on; | |
| tcp_nodelay on; | |
| keepalive_timeout 65; | |
| types_hash_max_size 2048; | |
| # server_tokens off; | |
| # server_names_hash_bucket_size 64; | |
| # server_name_in_redirect off; | |
| include /etc/nginx/mime.types; | |
| default_type application/octet-stream; | |
| ## | |
| # SSL Settings | |
| ## | |
| ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE | |
| ssl_prefer_server_ciphers on; | |
| ## | |
| # Logging Settings | |
| ## | |
| #access_log /var/log/nginx/access.log; | |
| #error_log /var/log/nginx/error.log; | |
| ## | |
| # Gzip Settings | |
| ## | |
| gzip on; | |
| # gzip_vary on; | |
| # gzip_proxied any; | |
| # gzip_comp_level 6; | |
| # gzip_buffers 16 8k; | |
| # gzip_http_version 1.1; | |
| # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; | |
| ## | |
| # Virtual Host Configs | |
| ## | |
| include /etc/nginx/conf.d/*.conf; | |
| include /etc/nginx/sites-enabled/*; | |
| } | |
| #mail { | |
| # # See sample authentication script at: | |
| # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript | |
| # | |
| # # auth_http localhost/auth.php; | |
| # # pop3_capabilities "TOP" "USER"; | |
| # # imap_capabilities "IMAP4rev1" "UIDPLUS"; | |
| # | |
| # server { | |
| # listen localhost:110; | |
| # protocol pop3; | |
| # proxy on; | |
| # } | |
| # | |
| # server { | |
| # listen localhost:143; | |
| # protocol imap; | |
| # proxy on; | |
| # } | |
| #} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment