1

Tengo un par de páginas web en mi ubuntu server 18.04 y tengo la siguiente estructura de carpetas:

/var/www/html/moon /var/www/wordpress

En el siguiente fichero tengo la config del portal en /var/www/html/moon fichero: 000-default.conf

<VirtualHost *:8080>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/moon
    <Directory /var/www/html/moon>
        AllowOverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

La config del portal en /var/www/wordpress: wordpress.conf

<VirtualHost *:8082>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/wordpress
    <Directory /var/www/wordpress>
        AllowOverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Ambos sitios estan habilitados con el comando a2ensite y los puertos en ports.conf están añadidos.

y en los ficheros del nginx tengo abierto lo siguiente:

fichero: default:

server {
    listen 80;
    listen 443 ssl default_server;
    ssl_certificate /etc/ssl/certs/public.pem;
    ssl_certificate_key /etc/ssl/private/private.key;
    

    root /var/www/html/moon;

    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;

    server_name moon.com;
  
    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    # pass PHP scripts to FastCGI server
    #
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
    
        # With php-fpm (or other unix sockets):
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    #   # With php-cgi (or other tcp sockets):
    #   fastcgi_pass 127.0.0.1:9000;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny all;
    }
}

fichero: wordpress:

server {
    listen 80;
    

    root /var/www/wordpress;

    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;

    server_name _;
  
    location / {
        proxy_pass http://127.0.0.1:8082;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    # pass PHP scripts to FastCGI server
    #
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
    
        # With php-fpm (or other unix sockets):
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    #   # With php-cgi (or other tcp sockets):
    #   fastcgi_pass 127.0.0.1:9000;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny all;
    }
}

Al poner la IP de mi dominio:8080 me carga bien el primer dominio (moon) pero al poner dominio:8082 me redirige automáticamente a dominio:8080 y no se por qué lo hace ni como solucionarlo, no veo nada mal a simple vista :(

Gracias de antemano!

2

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.