First, I will apologize if this has already been posted, but I have scoured google and this site for hours and can´t figure it out.
Here is my problem.
I have nginx 1.9.10 on Ubuntu 15.10 server.
I have a domain set up and have the wildcard * option set on the DNS.
In my root server directory, I am running wordpress network.
I am running multiple sites on the wordpress network, and accessing them by subdomain is working flawlessly.
What I am TRYING to do is add additional programs, ie: owncloud, moodle, a photo gallery, mail, etc. by installing them in subdirectories of my www root.
I want to be able to access them and load the appropriate index.php or index.htm either by typing:
http(s)://domain.com/subdirectory
or
subdomain.domain.com
The intent is that for example, if I type: moodle.domain.com OR domain.com/moodle, the program will launch.
I´ve tried
--"enabling" multiple virutual hosts using symbolic links for each in the sites-enabled directory
----this results in errors loading nginx saying that it is listening on port XXX multiple times.
--having only a www file "enabled" as above, and adding "location" tags in that file.
----the result is:
-----nginx starts but I get either a 404 page not found or 403 restricted error if I try accessing any of the programs that are installed in the subdirectories.
--creating a symbolic link for the index.php file for the program in the subdirectory
----(I know that this is very unlikely to be of any use, but I tried it anyway)
-----result: nothing loads
I have been afraid to play around with the php.ini in php5-fpm and the .htaccess files, because the last time I did that it was a disaster.
Could someone please post an example of how to make this work?
If it is going to involve editing config files, please be specific as to which one(s) and the syntax. I am a novice with this process--as is clearly evident.
Here is a copy of my current site-enabled file that is working: (I have edited out the actual domain and directories, but if you need this, I can give it to you).
------------------------------------------------------------------------
server {
server_name domain.com *.domain.com;
index index.php index.html index.htm;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!Anull:!md5;
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
root /media/xxxx/xxxxx;
#=========================Locations=============================
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
#===================PHP=================
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
------------------------------------------------------------------------
Thanks for any help you can give.
Here is my problem.
I have nginx 1.9.10 on Ubuntu 15.10 server.
I have a domain set up and have the wildcard * option set on the DNS.
In my root server directory, I am running wordpress network.
I am running multiple sites on the wordpress network, and accessing them by subdomain is working flawlessly.
What I am TRYING to do is add additional programs, ie: owncloud, moodle, a photo gallery, mail, etc. by installing them in subdirectories of my www root.
I want to be able to access them and load the appropriate index.php or index.htm either by typing:
http(s)://domain.com/subdirectory
or
subdomain.domain.com
The intent is that for example, if I type: moodle.domain.com OR domain.com/moodle, the program will launch.
I´ve tried
--"enabling" multiple virutual hosts using symbolic links for each in the sites-enabled directory
----this results in errors loading nginx saying that it is listening on port XXX multiple times.
--having only a www file "enabled" as above, and adding "location" tags in that file.
----the result is:
-----nginx starts but I get either a 404 page not found or 403 restricted error if I try accessing any of the programs that are installed in the subdirectories.
--creating a symbolic link for the index.php file for the program in the subdirectory
----(I know that this is very unlikely to be of any use, but I tried it anyway)
-----result: nothing loads
I have been afraid to play around with the php.ini in php5-fpm and the .htaccess files, because the last time I did that it was a disaster.
Could someone please post an example of how to make this work?
If it is going to involve editing config files, please be specific as to which one(s) and the syntax. I am a novice with this process--as is clearly evident.
Here is a copy of my current site-enabled file that is working: (I have edited out the actual domain and directories, but if you need this, I can give it to you).
------------------------------------------------------------------------
server {
server_name domain.com *.domain.com;
index index.php index.html index.htm;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!Anull:!md5;
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
root /media/xxxx/xxxxx;
#=========================Locations=============================
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
#===================PHP=================
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
------------------------------------------------------------------------
Thanks for any help you can give.