Hello is the first time that NGINX uses, and I’m turning my .htaccess to use it. Unfortunately the access is really long, and it is my first time I do this. I converted the .htaccess with winginx online tool, but unfortunately, load the conf changed, I restart the nginx service. When I click a link on the page, it automatically downloads Him the .php files.
Here’s my .htaccess file:
Below is my .conf instead of Nginx:
server {
listen 80;
server_name www.miosito.net miosito.net;
return 301 https://miosito.net$request_uri;
}
server {
ssl on;
listen 443 ssl http2;
server_name miosito.net www.miosito.net;
access_log /home/nginx/domains/miosito.net/log/access.log combined buffer=256k flush=60m;
error_log /home/nginx/domains/miosito.net/log/error.log error;
#rewrite_log on;
root /home/nginx/domains/miosito.net/public;
ssl_dhparam /etc/ssl/private/dhparams.pem;
ssl_certificate /etc/letsencrypt/live/miosito.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/miosito.net/privkey.pem;
#include /usr/local/nginx/conf/ssl_include.conf;
#rewrite ^/forum(?!/[0-9]+\-.+)(.*)$ $1 permanent;
#Enable HSTS, only for HTTPS!
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
add_header Content-Security-Policy upgrade-insecure-requests;
if ($http_host ~* "^.miosito.net"){
set $rule_0 1$rule_0;
}
if ($rule_0 = "1"){
rewrite ^/(.*)$ http://miosito.net/$1 permanent;
}
rewrite ^/upload/(.*)/(.*)x(.*)-(.*) /thumbs.php?src=http://miosito.net/upload/$1/$4&h=$3&w=$2&c=1;
rewrite ^/trofei/([w-]+)-([w-]+)/?$ /index.php?p=trofei&id=$1&nome=$2 last;
rewrite ^/video/([w-]+)-([w-]+)/?$ /index.php?p=video&id=$1&nome=$2 last;
rewrite ^/hashtag/?$ /index.php?p=tag_hash last;
rewrite ^/hashtag/([w-]+)/?$ /index.php?p=tag_hash&ricerca=$1 last;
rewrite ^/hashtag/([w-]+)/pagina=([w-]+)/?$ /index.php?p=tag_hash&ricerca=$1&pa=$2 last;
rewrite ^/eventi/?$ /index.php?p=evento last;
rewrite ^/eventi/([w-]+)/?$ /index.php?p=evento&modo=mostra&nome=$1 last;
rewrite ^/utente/([w-]+)/?$ /index.php?p=profile&nome=$1&sk=index last;
rewrite ^/utente/([w-]+)/?(amici|foto|video|stato)$ /index.php?p=profile&nome=$1&sk=$2 last;
rewrite ^/articolo/([w-]+)/?$ /index.php?p=articolo&id=$1 last;
rewrite ^/articolo/([w-]+)/pagina_commenti=([w-]+)/?$ /index.php?p=articolo&id=$1&pa=$2 last;
rewrite ^/giochi/([w-]+)-([w-]+)-([w-]+)/?$ /index.php?p=scheda_gioco&id=$1&nome=$2&console=$3 last;
rewrite ^/giochi/([w-]+)-([w-]+)-([w-]+)/?(news|gallery|video|trofei|obiettivi)$ /index.php?p=scheda_gioco&id=$1&nome=$2&console=$3&sk=$4 last;
rewrite ^/giochi/([w-]+)/([w-]+)/([w-]+)/p=([w-]+)/?$ /index.php?p=giochi&console=$1&genere=$2&nome_gioco=$3&pa=$4 last;
rewrite ^/giochi/([w-]+)/([w-]+)/p=([w-]+)/?$ /index.php?p=giochi&console=$1&genere=$2&pa=$3 last;
rewrite ^/giochi/([w-]+)/p=([w-]+)/?$ /index.php?p=giochi&tipo=$1&pa=$2 last;
rewrite ^/giochi/([w-]+)/?$ /index.php?p=giochi&tipo=$1 last;
rewrite ^/giochi/p=([w-]+)/?$ /index.php?p=giochi&pa=$1 last;
rewrite ^/giochi/?$ /index.php?p=giochi last;
rewrite ^/recensione/([w-]+)-([w-]+)-([w-]+)/?$ /index.php?p=recensione&id=$1&nome=$2&console=$3 last;
rewrite ^/dev/([w-]+)/?$ /index.php?p=devpub&tipo=dev&id=$1 last;
rewrite ^/pub/([w-]+)/?$ /index.php?p=devpub&tipo=pub&id=$1 last;
rewrite ^/login/?$ /login.php last;
rewrite ^/reg/?$ /reg.php last;
rewrite ^/logout/?$ /logout.php last;
rewrite ^/recupera/?$ /lost.php last;
rewrite ^/check/lost/([w-]+)/?$ /check.php?pagina=lost&code=$1 last;
rewrite ^/check/activation/([w-]+)-([w-]+)/?$ /check.php?pagina=activation&code1=$1&code2=$2 last;
rewrite ^/cookie/?$ /public.php?p=cookie last;
rewrite ^/404/?$ /public.php?p=404 last;
rewrite ^/info/?$ /public.php?p=info last;
rewrite ^/contatti/?$ /public.php?p=contatti last;
rewrite ^/jobs/?$ /public.php?p=jobs last;
rewrite ^/privacy/?$ /public.php?p=privacy last;
rewrite ^/team/?$ /public.php?p=team last;
rewrite ^/impostazioni/?$ /index.php?p=settings last;
rewrite ^/password/?$ /index.php?p=settings&modo=password last;
rewrite ^/preferiti/?$ /index.php?p=preferiti last;
rewrite ^/cerca/?$ /index.php?p=cerca last;
rewrite ^/cerca/ricerca=(.*)/?$ /index.php?p=cerca&ricerca=$1 last;
rewrite ^/cerca/pagina=([w-]+)/ricerca=(.*)/?$ /index.php?p=cerca&pa=$1&ricerca=$2 last;
rewrite ^/cerca/pagina=([w-]+)/?$ /index.php?p=cerca&pa=$1[QSA,L];
rewrite ^/(ps3|ps4|x360|xone|pc|ps2|psx|mac|xbox|ngc|android|iph|3ds|gb|gbc|wii|gba|ipad|wiiu|psvita|psp|ds|atv)/?$ /index.php?p=console&nome_console=$1 last;
rewrite ^/(PS3|PS4|X360|XONE|PC|PS2|PSX|MAC|XBOX|NGC|ANDROID|IPH|3DS|GB|GBC|WII|GBA|iPAD|WiiU|PSVITA|PSP|DS|ATV)/?$ /index.php?p=console&nome_console=$1 last;
include /usr/local/nginx/conf/php.conf;
include /usr/local/nginx/conf/drop.conf;
include /usr/local/nginx/conf/vts_server.conf;
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
You may want to check out the following sites to help you convert the file to something nginx understands: http://winginx.com/en/htaccess
https://www.nginx.com/blog/converting-apache-to-nginx-rewrite-rules/
Please let us know if there is anything else we can help you with.
Best, Mike DigitalOcean Support Check out our community for great tutorials, articles and FAQs! https://digitalocean.com/community
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.