Nginx + Rails, Default url not working
<p>I supposedly have my default url set as</p>

<blockquote>
  <p>example.com/asd/  ---> my root_path</p>
</blockquote>

<p>and everything loads correctly. However, everytime I click a </p>

<blockquote>
  <p>'&lt;%= link_to 'something', something_path %>'</p>
</blockquote>

<p>I'm directed to </p>

<blockquote>
  <p>example.com/something ---> without the /asd. </p>
</blockquote>

<p>Is this a problem with my nginx configurations or rails configuration? What should I do to solve it?</p>

<blockquote>
  <p><strong>--Extra-- If I enter to example.com/asd/something, everything loads fine too.</strong></p>
</blockquote>

<p>/etc/nginx/nginx.conf</p>

<blockquote>
  <p>user www-data; </p>
  
  <p>worker_processes auto; </p>
  
  <p>pid /run/nginx.pid;</p>
  
  <p>events {
          worker_connections 768; 
  } </p>
  
  <p>http {</p>

<pre><code>    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    client_max_body_size 250M;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
    gzip on;
    gzip_disable "msie6";
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json &gt;application/javascripttext/xml application/xml application/xml+rss &gt;text/javascript;
    include /etc/nginx/passenger.conf;
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*; 
</code></pre>
  
  <p>}</p>
</blockquote>

<p>/etc/nginx/passenger.conf</p>

<blockquote>
  <p>passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;</p>
  
  <p>passenger_ruby /home/rubyuser/.rvm/gems/ruby-2.3.0/wrappers/ruby; </p>
</blockquote>

<p>/etc/nginx/sites-available/default</p>

<blockquote>
  <p>server { </p>

<pre><code>    listen 80 ;
    listen 443 ssl;
    server_name example.com;
    root /home/user/app/current/public;
    passenger_enabled on;
    passenger_app_env production;  
</code></pre>
  
  <p>}</p>
</blockquote>

<p>production.rb</p>

<blockquote>
  <p>Rails.application.configure do</p>

<pre><code>    config.cache_classes = true
    config.eager_load = true
    config.consider_all_requests_local= false
    config.action_controller.perform_caching = true
    config.action_dispatch.rack_cache = true
    config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
    config.assets.js_compressor= :uglifier
    config.assets.css_compressor = :sass
    config.assets.compile = true
    config.assets.precompile =  ['*.js', '*.css', '*.css.erb']
    config.assets.digest = true
    config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
    config.log_level = :debug
    config.relative_url_root = "/asd"
    config.action_controller.asset_host = 'example.com'
    config.i18n.fallbacks = true
    config.active_support.deprecation = :notify
    config.log_formatter = ::Logger::Formatter.new
    config.active_record.dump_schema_after_migration = false
    config.force_ssl = false
    Rails.application.routes.default_url_options[:host] = 'example.com/asd'  
</code></pre>
  
  <p>end</p>
</blockquote>