i have a domain www.mydomain.com. it is hosted in apache.
when i hit this domain, it takes me to apache default page.
How to use custom virtual host in apache like nginx? Nginx example:
server {
listen 80;
server_name ~^(.*).dev.domain$;
location / {
proxy_pass http://$1.domain:8080;
proxy_set_header X-Real-IP $remote_addr;
}
}
In apache i planed like this:
<VirtualHost *:8080>
DocumentRoot /home/$1
ServerName (.*).mrtigra.info
</VirtualHost>
I have subdomain set up under Nginx and proxy passing to Apache to serve PHP files
Below is my config:
server {
listen 80;
server_name sub.domain.com.au;
location ~* \.(css|js|jpg|jpeg|gif|png|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|docx|xlsx)$ {
root /var/www/html/domain;
index index.php;
I am attempting to create a 301 re-direct from one domain to another with nginx.
I have the following set up:
nginx as reverse proxy
apache (with passenger) for serving content
Now I have simple Sinatra application and the following happens if I try to access different things:
domain.com/hi - Sinatra says me Hi as was coded
domain.com/readme.txt (static file) - it is fetched correctly from the 'public_html' folder by nginx
And finally - domain.com/ or domain.com - 403 er
I know this must have been answered a million times but I can't seem to get it to work
I would like to redirect a subdomain to a subdirectory.
I am currently using
server {
server_name sub.domain.com;
rewrite ^(.*) http://www.domain.com/sub-directory permanent;
}
If I navigate to sub.domain.com I am redirected to http://www.domain.com
EDIT
Here's my full config.
I have set up Nginx as a reverse proxy to Apache on a web server.
Nginx is listening on 0.0.0.0:80 and passing through to 127.0.0.1:81
This all seems to be working fine, except when I first load the site at the root level (i.e.
I'm trying to set up an administrative web application in the subfolder /admin of my domain.
I would like to make sure this app is as secure as I can make it (not because it is absolutely necessary, but because I'm interested in learning web security) and I want it to run over https, while the rest of the website (non-admin locations) should be http.
I've got nginx got it set up as is explained
I need a help on setting-up a custom CNAME records for two sub-domains which will point to main domain name http://www.domain.com/.
http://it.domain.com/ (Italy)
http://fr.domain.com/ (France)
I do not not mean here sub-domain re-direction which can be easily done through cPanel "subdomains".