Topic: nginx config problem running wordpress on iredmail setup
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9 MYSQL edition.
- Deployed with iRedMail Easy or the downloadable installer? - Downloaded & ran iRedMail.sh
- Linux/BSD distribution name and version: Ubuntu 16.04 LTS
- Store mail accounts in which backend: MySQL
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedAdmin-Pro? - not pro - the free version
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue: There are no access.log or error.log messages related to this problem.
====
Hi,
I have installed iredmail on a clean server running ubuntu 16. iredmail and all its functions are working PERFECTLY.
My question here relates to moving wordpress websites of mine on to this same server and the problems I'm running into there.
I began by putting my own custom php code on to the server, and that worked great when I did it like this: I put it all in /var/www/html/xxx/ - where xxx is my php system.
I can therefore access and run my php fine from the ip address like: 1.2.3.4:/xxx/
However, I'm totally stumped when moving in my wordpress. My wordpress
site is bannedyoutube.com. I even used certbot to set up an SSL certificate for it.
Below is my file bannedyoutube.conf.
As you can see I've been experimenting. I created 2 blocks.
The top block is something I got from a website, which aims to redirect
www.bannedyoutube.com to bannedyoutube.com
The 2nd block was the main block for bannedyoutube.com. Later what I did as an experiment was to move 2 of the SSL 443 lines to the top of
the block to see if it helps.
Here is what actually happens with it:-
If I type: https://1.2.3.4/bannedyoutube/public_html/ in my browser, I then see the wordpress website showing.
But if I type: http://bannedyoutube.com then it tries to download the index.php of my website.
In the config file below you'll see that I tried to have some code for
.php because for some reason, the nginx is not executing the php. In
fact the php section in my config: # Normal PHP scripts - is what I
found in the nginx templates that iredmail had installed.
I could not understand why .php is not EXECUTED when it is run via
the config file I made for the wordpress.
I have tried error logging and checking the access logs.
I don't know what to do. Can someone help me please.
Here is bannedyoutube.conf:
server {
listen 80;
listen 443 ssl;
# redirect calls to www: url: https://www.nginx.com/blog/creating-ngi … ite-rules/
server_name www.bannedyoutube.com;
return 301 $scheme://bannedyoutube.com$request_uri;
}
server {
listen 80;
listen [::]:80;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
server_name bannedyoutube.com;
# access_log /var/log/nginx/fred.access.log;
# error_log /var/log/nginx/yoursite.error_log info;
error_log /var/log/nginx/bannedyoutube.error_log debug;
rewrite_log on;
# error_log /var/log/nginx/bannedyoutube.error_log notice;
# this works. It creates a new root location for everything
#location / {
#root /var/www/;
#}
root /var/www/html/bannedyoutube/public_html/;
index index.php index.html index.htm;
# Normal PHP scripts
location ~ \.php$ {
include /etc/nginx/templates/fastcgi_php.tmpl;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
# location ~ \.php$ {
# try_files $uri =404;
# fastcgi_pass unix:/var/run/php/php7.0-fpm.pid;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# include fastcgi_params;
# }
ssl_certificate /etc/letsencrypt/live/bannedyoutube.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/bannedyoutube.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.