Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8399789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:23:58+00:00 2026-06-09T21:23:58+00:00

I’ve been banging around with the process of migrating a site from Apache to

  • 0

I’ve been banging around with the process of migrating a site from Apache to Nginx and I’m about to lose my mind. The virtual host doesn’t want to serve static resources (css, js, etc.) and I can’t seem to figure out why. The server block looks like this:

server {
  listen      443 default_server ssl;
  server_name dev.myproject.mydomain.net;
  root        /opt/dev/myproject;
  index       index.php;

  ssl_certificate      /etc/ssl/certs/server.crt;
  ssl_certificate_key  /etc/ssl/certs/server.pem;

  access_log /var/log/nginx/vh.project.dev.access.log;
  error_log  /var/log/nginx/vh.project.dev.error.log;

  location ~ ^/alias_name/(.*) {
    alias /opt/dev/myproject/www/$1;

    location ~ ^/alias_name/(.+\.php)$ {
      alias /opt/dev/myprojectp/www/$1;
      include /etc/nginx/conf/php;
    }
  }

  location ~ \.php$ {
    include /etc/nginx/conf/php;
  }

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

What am I missing? I know it’s my inexperience with Nginx, but any advice would be much appreciated at this point.

Thanks.

UPDATE

This appears to be related to my alias which I was having trouble with before. If I point my document root to the alias location (/opt/dev/myprojectp/www), and try to render static content without the alias, it renders fine. As soon as I throw the alias in the URL…not so much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:24:00+00:00Added an answer on June 9, 2026 at 9:24 pm

    Okay, so I may have found my own answer by brute force trial and error. This virtual host server block seems to serve PHP and static content properly:

    server {
      listen      443 default_server ssl;
      server_name dev.myproject.mydomain.net;
      root        /opt/dev/project-root;
      index       index.php;
    
      ssl_certificate      /etc/ssl/certs/server.crt;
      ssl_certificate_key  /etc/ssl/certs/server.pem;
    
      access_log /var/log/nginx/myproject.dev.access.log;
      error_log  /var/log/nginx/myproject.dev.error.log;
    
      location ~ ^/alias_name/(.+\.php)$ {
        alias /opt/dev/project-root/www/$1;
        include /etc/nginx/conf/php;
      }
      location ~ ^/alias_name/(.*) {
        alias /opt/dev/project-root/www/$1;
      }
    
      location ~ \.php$ {
        include /etc/nginx/conf/php;
      }
    }
    

    I don’t know whether I’ll bump into problems and I can’t say that I fully understand the difference, but simply removing the nested location blocks seems to have done the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I don't have much knowledge about the IPv6 protocol, so sorry if the question
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.