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; | |
listen [::]:80; | |
server_name example.com; | |
return 301 https://$server_name$request_uri; | |
} | |
server { | |
listen 443 http2 ssl default_server; | |
server_name example.com *.example.com; | |
include snippets/ssl-params.conf; | |
ssl_certificate /etc/letsencrypt/live/example.com-0001/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/example.com-0001/privkey.pem; | |
root /var/www/example.com/html; | |
#Add index.php to the list if you are using PHP | |
index index.html index.php; | |
location ~ /.well-known{ | |
allow all; | |
} | |
location /phpmyadmin { | |
try_files $uri $uri/ =404; | |
auth_basic "Restricted Content"; | |
auth_basic_user_file /etc/nginx/.htpasswd; | |
} | |
###.PHP FILES PROXY### | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
#proxy_set_header X-Real-IP $remote_addr; | |
#proxy_set_header X-Forwarded-For $remote_addr; | |
#proxy_set_header Host $host; | |
#proxy_pass http://127.0.0.1:9000; | |
# Cache configuration | |
#proxy_cache revers_cache; | |
#proxy_cache_valid 3s; | |
#proxy_no_cache $cookie_PHPSESSID; | |
#proxy_cache_bypass $cookie_PHPSESSID; | |
#proxy_cache_key "$scheme$host$request_uri"; | |
#add_header X-Cache $upstream_cache_status; | |
} | |
###.PHP FILES PROXY### | |
} | |
server { | |
listen 443 http2 ssl; | |
server_name api.example.com; | |
ssl_certificate /etc/letsencrypt/live/example.com-0001/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/example.com-0001/privkey.pem; | |
root /var/www/example.com/api/public/; | |
#Add index.php to the list if you are using PHP | |
index index.php; | |
location = /Config.php { | |
deny all; | |
} | |
location / { | |
try_files $uri /index.php$is_args$args; | |
} | |
location ~ \.php { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
fastcgi_index index.php; | |
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment