Open SkOODaT opened 7 years ago
Thanks for your contribution. Peeps, how about adding this in the install.sh
questionary if someone has nginx then set it up accordingly? We could also add the apache2 v-host file of the Wiki accordingly, if someone sets on apache2 instead nginx, what most people are doing.
Thank you very much will take a look at it soon!
Many people asking in Discord for help with nginx and most of them I could help. So I'll Post my config here! (This is for php7, should work on php5 too)
**YOURDOMAIN** (twice)
#Add domain here e.g. most-awesome-pokemon-website.com
**/path/to/your/fullchain.pem**
#Path to letsencrypt fullchain.pem e.g. /etc/letsencrypt/live/YOURDOMAIN/fullchain.pem
**/path/to/your/privkey.pem**
#Path to letsencrypt privkey.pem e.g. /etc/letsencrypt/live/YOURDOMAIN/fullchain.pem
**/path/to/Worldopole**
#Path to Worldopole folder: e.g. /var/www/html/Worldopole
**http://YOUR.IP:5000/**
#IP of your map and port (default 5000)
(Open with: sudo nano /etc/nginx/sites-available/mydomain
)
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name **YOURDOMAIN**;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
index index.php;
server_name **YOURDOMAIN**;
access_log /var/log/nginx/www.access.log;
error_log /var/log/nginx/www.error.log;
rewrite_log on;
log_not_found off;
charset utf-8;
#specific pokemon vs all pokemon
rewrite ^/pokemon/(.+)$ /index.php?page=pokemon&id=$1 break;
rewrite ^/pokemon/?$ /index.php?page=pokedex break;
#page rewrites
rewrite ^/(pokestops|gym|dashboard|devlog|faq|trainer|nests)$ /index.php?page=$1 break;
#static files
rewrite "^/core/(css|js)/(.+)\.(\d{10})\.(css|js)$" /core/$1/$2.$4 break;
client_header_buffer_size 4k;
client_max_body_size 2047M;
client_body_buffer_size 128k;
client_body_temp_path /tmp 1 2;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_session_cache shared:ssl_session_cache:10m;
ssl_certificate **/path/to/your/fullchain.pem**;
ssl_certificate_key **/path/to/your/privkey.pem**;
root **/path/to/Worldopole**;
location /secret_nginx_status {
stub_status on;
access_log off;
}
##Parse all .php files
location ~ .php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_intercept_errors off;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffering on;
fastcgi_max_temp_file_size 0;
}
##Disable viewing .htaccess & .htpassword
location ~ /\.ht {
deny all;
return 404;
}
location /map/ {
proxy_pass **http://YOUR.IP:5000/**;
}
}
/etc/nginx/sites-available
nameofyoursite.conf
add in ....
Then make a symbolic link in your /etc/nginx/sites-enabled
create a *.sock file in /run/php/SERVERNAME.sock
your going to half to customize everything tho, i had a buddy help me set it up.....
I can try to help if anyone has questions but i am completely new to ngrix, hopefully i included everything that makes it work