I'm using nginx (not Apache) and I can't get the nginx server to redirect correctly to the dolphin website.
Here's my setup:
1. The DNS server is pointing the name "mydomain.com" to the IP address of my server.
2. A "C" record also exists which points the "www" thingy to "@" (meaning "go to the same thing as mydomain.com")
Now this config should simply tell the browser to go my server when a user types "mydomain.com".
From now, it's the responsibility of nginx's configuration to take the user to a specific directory, right?
In /etc/nginx/conf.d/default.conf I have the following:
server {
listen 80;
server_name 192.81.213.53 mydomain.com;
root /usr/share/nginx/html/dolphin;
location / {
root /usr/share/nginx/html/dolphin;
include /usr/share/nginx/html/dolphin/dolphin_rewrite.conf;
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html/dolphin;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html/dolphin;
}
location ~ .php$ { root /usr/share/nginx/html/dolphin;
try_files $uri =404;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# Boonex Dolphin - related: serve static files directly
location ~* ^/dolphin.+(templates|flash|media|plugins)/.+.(jpg|jpeg|gif|css|png|js|ico)$ {
access_log off;
expires 30d;
}
location ~ /.ht {
deny all;
}
}
(I always restart the nginx service after every change)
As you can see I pushed "dolphin" everywhere I could. However, what currently happens is this:
1. When I go to mydomain.com the website indeed loads, BUT it looks like there're no CSS files - no background, no structure, everything in an ugly text format, no styling applied whatsoever.
2. The URL immediately changes from "mydomain.com" to "192.81.213.53".
Does anyone know how to solve these problems?
Thank you!!!
|
Did you install dolphin before or after you setup the domain name? https://www.deanbassett.com |
Look at your header_inc file and see what is there; may be all you need to do to get this running. I actually migrated my site from an Apache server to the NginX server; I doubt if you need to reinstall anything. Do you want me to take a look at things? Geeks, making the world a better place |
I would also suggest learning a bit more about the NginX configuration. Geeks, making the world a better place |
Hey Deano, Geek_girl, Thank you so much for the replies! I guess you both were right, it's a matter of initial Dolphin config. I went to header.inc.php and edited one single line, from this: $site['url'] = "http://192.81.213.53/dolphin"; to this: $site['url'] = "http://mydomain.com/"; Now the browser finds the website ok and doesn't change the url back to an IP number. However, the website started acting as if I didn't have the rules rewritten. The two most vivid problems when the you don't rewrite rules on nginx are: 1) Profile page doesn't work. 2) in the admin panel - some modules don't work. So I had to change how the rules are rewritten. I changed every line in the dolphin_rewrite.conf from this: rewrite "^/dolphin/blogs[/]{0,1}$" /dolphin/modules/boonex/blogs/blogs.php last; to this (removed the reference to "dolphin") rewrite "^/blogs[/]{0,1}$" /modules/boonex/blogs/blogs.php last; Now the first problem is solved - the profile is shown correctly, but the second problem is still there - some modules still don't work. The modules that don't work reside at the address of a form "mydomain.com/m/module_name/administration" while the modules that do work reside at the address of a form "mydomain.com/modules/?r=module_name/administration" so it seems very much like a problem with rewriting, but I don't know where to change that. Thank you guys for your help!!! |
clear your cache? |
Let me get my Nginx configuration and send it to you by email. Read up on the location and root for nginx config to get an understanding of how that works. Some things are best put in the http section and not in a location. Geeks, making the world a better place |
If you are going to include each server, I suggest learning how to set up sites_enabled and sites_available; The site enabled directory holds symbolic links to the sites in sites available; when you are ready to take a site live, you add a symbolic link to the sites_enabled directory. Geeks, making the world a better place |
By the way, worker_processes will equal the number of computer cores you have, or wish to assign, to nginx; If you have a six core processor you can assign all six for niginx to use or just four. Geeks, making the world a better place |
location ~ /.ht I would escape the . Geeks, making the world a better place |
OK, problem solved: What caused the problem was me including the following lines in the default.conf: # deny access to .htaccess files, if Apache's document root concurs with nginx's one It was advised somewhere to include these lines, but I think I don't really need it, since I don't have Apache on my server at all. Thank you all guys (and girls of course) for your support! |
Did you get my emails I sent to you with the config files? Now, Nginx does not use .htaccess files, but you can use them to deny access to a directory that contains the .htacess files as Dolphin has these in all the directories to block access to them. I mentioned that you should probably escape the dot. I have that in my config and my site is working as it should. Look at the config I sent to you as I put it together from reading the top sites on configuring Nginx. Geeks, making the world a better place |