Results 1 to 1 of 1

Thread: How to correctly deploy ASP MVC Net Code 3.1 project into a subfolder of apache

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    782

    How to correctly deploy ASP MVC Net Code 3.1 project into a subfolder of apache

    How to correctly deploy ASP MVC Net Code 3.1 project into a subfolder of apache (CentOS 7)?

    Apache's default folder is /var/www/html and I want to deploy it in /var/www/html/myapp, so I can expect to see my app on the internet from https://example.com/myapp

    All of the files (includes all folders inside the wwwroot) are now deployed in myapp folder, but it has the wrong address, I got 404 when my app trying to get all of the .css files .. like this one below:

    GET https://example.com/css/style.min.css net::ERR_ABORTED 404 (Not Found)

    GET https://example.com/vendor/bars.css net::ERR_ABORTED 404 (Not Found)
    it should be https://example.com/myapp/css/style.min.css

    what I missed?

    === Startup.cs ==

    app.UseStaticFiles();

    app.UseStaticFiles(new StaticFileOptions
    {
    FileProvider = new PhysicalFileProvider(Path.Combine(
    AppDomain.CurrentDomain.BaseDirectory,
    "wwwroot/vendor")),
    });
    === Program.cs ==

    public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
    .ConfigureWebHostDefaults(webBuilder =>
    {
    webBuilder.UseStartup<Startup>()
    .UseUrls("http://127.0.0.1:5000");
    });
    === httpd.conf ===

    <VirtualHost *:443>

    ServerName example.com
    ServerAlias example.com
    ServerAdmin info@example.com

    DocumentRoot /var/www/html

    <Directory /var/www/html>
    Options -Indexes +FollowSymLinks
    AllowOverride All
    </Directory>

    <Location /myapp/>
    ProxyPass http://localhost:5000/
    ProxyPassReverse http://localhost:5000/
    Require all granted
    </Location>
    Attached Images Attached Images   
    Last edited by Winanjaya; May 25th, 2021 at 11:47 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width