Hi there people.
I recently switched over from Apache to Nginx and as most of you know... The rewriting structure is totally different and the commands in .htaccess become invalid.
I have been browsing the internetz for a while and I have stumbled upon many topics in this section of this website and many other how to... And somehow, I do not manage to get it working on my domain.
I have installed the "Nginx Compatibility" plugin and I have tried to do as instructed, but to no avail. I would prefer to do things without the plugin, but if it is necessary, then yea... :) I will not mind using it.
This is the data I use, can anyone, please help me out? Oh, I did manage to get the rewrite on and everything, but there was 1 huge problem and that is: When it's switched on, I cannot access the admin section... So there is something wrong in the code I use...
Please help me figuring out how to get it on. >:)
This is the default file that has no rewrite commands - I would prefer to use this without plugins.
[ Moderator Note: Please post code or markup snippets between backticks or use the code button. Not the blockquote. ]
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts
server {
listen 80; ## listen for ipv4
listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name the website.net;
server_name_in_redirect off;
fastcgi_buffer_size 32k;
fastcgi_buffers 16 32k;
fastcgi_busy_buffers_size 64k;
fastcgi_temp_file_write_size 64k;
location / {
root /var/www;
index index.html index.htm index.php;
}
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /var/www/nginx-default;
#}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
#proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /var/www;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
try_files $uri @wordpress;
fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name;
}
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
What I also need to say is, I really hate the default part that is added in the permalinks section which is: index.php - This led to 404 errors, and is the main reason why I downloaded nginx compatibilty plugin. If there is a simple code that can be added to the provided file to remove the index.php part from the link, I will be really thankful to you. ;)
I hope that I can receive the help here. :)
These are the suggestions by the plugin creator which I don't manage to implement in my file: http://wordpress.org/extend/plugins/nginx-compatibility/other_notes/
I run Nginx. 0.7.67