[SOLUTION POSTED // unconfirmed] Installation problem

murry
Posts: 1
Joined: Sat Oct 07, 2017 12:06 pm

[SOLUTION POSTED // unconfirmed] Installation problem

Post by murry »

I downloaded the zip file, unzip it and placed on the server. Homepage loads fine. I cannot login to the admin page to edit content. I get a 404:
The requested URL /loginURL was not found on this server.

Looking at the zip content, there are only: index.php and themes directory. What am I missing?
User avatar
wiz
Admin
Posts: 569
Joined: Sat Oct 30, 2010 12:23 am

Re: Installation problem

Post by wiz »

You should be also seeing a file named .htaccess. Seems like your hosting package doesn't htaccess, which creates clean URLs.
If you are not running on a Apache server/hosting package, an additional step will be required based on what server you are on.
- If you are running on a IIS server, editing of your web.config will be required: https://github.com/robiso/wondercms/wik ... ver-config (on IIS servers, web.config is the equivalent of htaccess on an Apache server)
- If you are running on an NGINX server, editing of nginx.conf will be required: https://github.com/robiso/wondercms/wik ... ver-config (on NGINX servers, nginx.conf is the equivalent of htaccess on an Apache server)

You can still access your login URL at example.com/?page=loginURL (using the ?page= parameter), to see if everything works correctly, but your host will have to enable either htaccess support for your hosting package or if you're running on NGINX or IIS, editing as shown in the links above will be required and this will be done automatically.

Can you check what type of hosting package you're on with your provider?
DesCod
Posts: 6
Joined: Wed Oct 18, 2017 11:54 pm

Re: Installation problem

Post by DesCod »

I've edited nginx.conf as you recommend, but I can not configure WonderCMS to work on a subdomain (test.mysite.com). I go to the main page, click the link - login and I send to the mysite.com :(
User avatar
wiz
Admin
Posts: 569
Joined: Sat Oct 30, 2010 12:23 am

Re: Installation problem

Post by wiz »

Hi DesCod.

Can you try replacing the bottom code in your nginx.conf? Please note you'll have to replace "yourSubdomain" with your real subdomain and http://yourSubdomain.domain.com with your actual subdomain and domain. The below part takes care of the URL rewriting that you're having trouble with.

Code: Select all

location /yourSubdomain/ {
	if (!-e $request_filename) {
		rewrite ^/(.+)$ http://yourSubdomain.mysite.com/index.php?page=$1 last;
	}
}
We might have to try a few variations, I'm hoping this will work on it's first try. Let me know how this works for you.
DesCod
Posts: 6
Joined: Wed Oct 18, 2017 11:54 pm

Re: Installation problem

Post by DesCod »

Glad to see you wiz!
Here is my current nginx config:

Code: Select all

server	{
	listen 80;
	server_name bitstyl.ru *.bitstyl.ru;

	location / {
        	root   /var/www/bitstyl.ru/$subdomain;
        	index index.php index.html index.htm;
    	}

	set $subdomain "";
	if ($host ~* ^([a-z0-9-\.]+)\.bitstyl.ru$) {
	set $subdomain $1;
	}

	if ($host ~* ^www.bitstyl.ru$) {
	set $subdomain "";
	}
}


server	{
	listen 443 ssl;
	server_name bitstyl.ru *.bitstyl.ru;
        root /var/www/bitstyl.ru/$subdomain;

	set $subdomain "";
	if ($host ~* ^([a-z0-9-\.]+)\.bitstyl.ru$) {
	set $subdomain $1;
	}
	if ($host ~* ^www.bitstyl.ru$) {
	set $subdomain "";
	}

       index index.php index.html index.htm;
 	
	location ~ /.well-known {
 		allow all;
 	}

	location /.well-known {
    	root /var/www/bitstyl.ru/$subdomain;
	}
		
		fastcgi_param HTTPS on;
		include /etc/nginx/include/ssl;
		include /etc/nginx/include/php;

	ssl_certificate /etc/letsencrypt/live/bitstyl.ru/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/bitstyl.ru/privkey.pem;
	ssl_trusted_certificate /etc/letsencrypt/live/bitstyl.ru/chain.pem;

	ssl_stapling on;
	ssl_stapling_verify on;
	resolver 192.168.1.1 8.8.8.8;

	add_header Strict-Transport-Security "max-age=31536000";

	add_header Content-Security-Policy "img-src https: data:; upgrade-insecure-requests";
		
		gzip on;
		gzip_disable "msie6";
		gzip_comp_level	6;
		gzip_min_length	1100;
		gzip_buffers 16 8k;
		gzip_proxied any;
		gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/javascript application/json application/xml+rss;

		location ~* /(?:uploads|files)/.*\.php$ {
                deny all; # запрет для загруженных скриптов
        }

        location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
                access_log off;
                log_not_found off;
                expires max;
        }
		
	location ~ /\.ht {
		deny all;
    	}

	location = /robots.txt {
		return 200 "Host: https://\$host\n";
	}

	if (!-e $request_filename) {
        	rewrite ^/(.+)$ /index.php?page=$1 last;
	}		
}
as you can see there are two sites - bitstyl.ru and test.bitstyl.ru (now there is installed REDAXSCRIPT and it works as it should)
It's only necessary to install WonderCMS in the subdomain instead of REDAXSCRIPT, the site becomes available only on the first page, then, at any transition, 404 bitstyl.ru appears.

I will try to prescribe what you recommend.
DesCod
Posts: 6
Joined: Wed Oct 18, 2017 11:54 pm

Re: Installation problem

Post by DesCod »

I added:

Code: Select all

	location /wonder/ {
	if (! -e $ request_filename) {
	rewrite ^ / (. +) $ https://wonder.bitstyl.ru/index.php?page=$1 last;
	}
}
no changes :(
User avatar
wiz
Admin
Posts: 569
Joined: Sat Oct 30, 2010 12:23 am

Re: Installation problem

Post by wiz »

With a simple test - by adding ?page= I was able to access these pages, such as:
https://wonder.bitstyl.ru/?page=loginURL
https://wonder.bitstyl.ru/?page=example

Looks like the URL rewriting nginx.conf isn't working properly. In your code, it seems to have added spaces between characters.
Can you try this again?

Code: Select all

location /wonder/ {
	if (!-e $request_filename) {
		rewrite ^/(.+)$ https://bitstyl.ru/wonder/index.php?page=$1 last;
	}
}
And try visiting https://bitstyl.ru/wonder/ (this already displays WonderCMS correctly, please try the above config.
We'll work it from there.
DesCod
Posts: 6
Joined: Wed Oct 18, 2017 11:54 pm

Re: Installation problem

Post by DesCod »

I do not understand ....
rewrote:

Code: Select all

	location /wonder/ {
	if (! -e $ request_filename) {
	rewrite ^ / (. +) $ https://bitstyl.ru/wonder/index.php?page=$1 last;
	}
}
https://bitstyl.ru/wonder/loginURL - 404
User avatar
wiz
Admin
Posts: 569
Joined: Sat Oct 30, 2010 12:23 am

Re: Installation problem

Post by wiz »

I'm not sure why it doesn't work as I don't have an NGINX server to test with.

You can try with:

Code: Select all

location / {
	if (!-e $request_filename) {
		rewrite ^/(.+)$ https://bitstyl.ru/wonder/index.php?page=$1 last;
	}
}
And we can check if it works at: https://bitstyl.ru/wonder/
I have read some posts that the server has to be restarted, can you possibly restart your server after saving the above config?
DesCod
Posts: 6
Joined: Wed Oct 18, 2017 11:54 pm

Re: Installation problem

Post by DesCod »

Without problems, the server is under my complete control, and I always restart it after making changes
Post Reply