hey!
i confirmed it used to work greatly from 08/2012 to 06/2014
i did no vps reboot in this laps of time.
i was working as teacher and needed subdomain easy
create or delete in one minute!
avoiding me to do subdomain process…
(no database site)
maybe it needs a custom module to be select/unselect
at compilation of nginx…
and google found subdomain if search contain specifics theme/words.
i have userdir.conf (maybe useless because i point on /var/www):
location ~ ^/~(.+?)(/.*)?$ {
alias /home/$1/http$2;
autoindex on;
}
On Thu, Aug 14, 2014 at 09:12:39AM +0200, Pascale Camille wrote:
Hi there,
i confirmed it used to work greatly
i was working as teacher and needed subdomain easy
create or delete in one minute!
avoiding me to do subdomain process…
(no database site)
I don’t see how what you provided could ever have worked as you
describe.
However, that does not matter: the following skeleton seems to work for
me; add the rest of your config in as needed:
Preparation:
$ mkdir -p /tmp/www/{one,two,three}
$ for i in /tmp/www/{one,two,three}; do
echo “content of $i/index.html” > $i/index.html; done
nginx.conf server block:
server {
server_name ~^(?P.+).example.com;
root /tmp/www/$user;
}
Note that I use the “(?P<” syntax for the named capture; that’s what my
pcre engine needs.
if i remove
return 301 http://~^(?.+).2maxi.com$request_uri;
of course i have just www.domain.tld access,
and cant access to something like 2maxi.com/subdomain
as subdomain folder is at the same level as domain folder
(not inside i meam)
server {
listen 80;
charset utf-8;
source_charset utf-8;
server_name www.2maxi.com;
root /var/www/www;
index 2maxi.com.html index.php;
hi,
thanks for mini lesson of batch command useful in futur.
hum, i did what you wrote
i rebuilded vps with debian 7
remove apache
just fail to restart nginx editing nginx.conf
so i put in /etc/nginx/sites-available/default
hi, @bodomic, i just did again and remembered error, (ssl not implemented)
in webrowser it rewrote in loop: http://198.23.139.108//www.2maxi.com/www.2maxi.com/www.2maxi.com
/www.2maxi.com/www.2maxi.com/www.2maxi.com/www.2maxi.com/www.2maxi.com
/www.2maxi.com/www.2maxi.com/www.2maxi.com/www.2maxi.com/www.2maxi.com
/www.2maxi.com/www.2maxi.com/www.2maxi.com/www.2maxi.com/www.2maxi.com
/www.2maxi.com/www.2maxi.com/
I think your current config is too complicated now so that your regular
expressions do not do what you think they should.
Try a separate server setup in this manner:
server {
listen 80 default;
server_name .example.com;
set $project www;
set $user www-data;
if ($host ~* ^([^.]+)\.([^.]+)\.example\.com$) {
set $project $1;
set $user $2;
}
if (!-d /home/$user/sites/$project/public) { rewrite ^(.*)$ http://www.example.com permanent; }
root /home/$user/sites/$project/public;
index index.php index.htm index.html;
}
Create some dns names like user1.www.example.com (or just put them to
your
local hosts file) all pointing to the same host.
Create folders /home/user1/sites/www/public and put index.html stating
“This
is a home of user1” there.
Make sure you have access and error logs.
On Thu, Aug 14, 2014 at 04:33:04PM +0200, Pascale Camille wrote:
Hi there,
root@www:/#
So: they both say that if the request gets to nginx, nginx responds as
you want it to.
so in web browser i should see
content of /tmp/www/one/index.html
…if the browser makes the request of nginx.
but i have 'this page not available … DNS lookup failed"
And that says that the browser did not know where nginx was.
You need your browser to be able to turn the hostnames one.2maxi.com and nil.2maxi.com (and any others that you will use) into the IP address of
your nginx server.
This is usually either “set up dns right”, or “populate your browser
machines etc/hosts file” – but it might be “get resolution working on
your proxy server” or something else instead.
It’s outside the scope of nginx, but may be useful to add to DNS many
individual A records, or a single wildcard one, for the hostnames that
you care about.
That suggests that your browser can resolve 2maxi.com to the nginx
server,
and hopefully it is clear from your configuration why the response was
what it was.
up
for me tuxlite or other script made me crazy
-i could not modify script or nginx conf without crashing
-as strange it is, i could not make php working !
so the last working solution for me was a site that
pre-build a script with my parameters : http://simpleserversetup.com/
and i modify the downloaded script modding all vhost the way i need