Apache + Passenger でのdevelopment環境で、クライアントPCからアクセスしても、トップページのhtmlの部分だけ表示されます。
それ以外のcssなどは、Not Foundになります。(ブラウザのコンソールのメッセージ)
また、その他のページにアクセスしたらNot Foundと表示されます。
バージョン
OS Centos7
Rails 5.0.1
Apache 2.4.6
Passenger 5.0.30
http://アプリケーション名.ホスト名/
のバーチャルホストの設定でアクセスするようにしています。
/etc/httpd/conf.d/vhost.conf
<VirtualHost *:80> ServerName <アプリケーション名>.<ホスト名> RailsEnv development DocumentRoot /var/www/アプリケーション名/public <Directory /var/www/アプリケーション名/public> AuthType Basic AuthUserFile "htpasswdのパス" AuthName "basic認証の名前" AllowOverride all Require valid-user Options -MultiViews </Directory> </VirtualHost>
トップページのアクセスは、development.logでは200 OKが記録されています。
Started GET "/" for <クライアントのIP> at 2017-01-22 13:58:31 +0900 Processing by TopController#index as HTML Rendering <省略> Rendered <省略> <省略> Completed 200 OK in 64ms (Views: 63.4ms | ActiveRecord: 0.0ms)
それ以外のページへのアクセスは、クライアント側は(Not Found)で、development.logは記録がありませんでした。
もともとローカルの仮想環境で開発していて、その時は正常でした。(rails serverでlocalhost:3000のアクセス)
SELinuxを完全に無効にしてみたりもしましたが治りませんでした。
怪しいところ、些細なことでもいいのでアドバイス頂きたいです。
追記
apache conf
# SHTMLに対応していないブラウザ SetEnvIfExpr "!(%{HTTP_ACCEPT} -strcmatch '*application/xhtml+xml*') || %{HTTP_USER_AGENT} =~ m#UP\\.Browser/6\\.2|Nintendo 3DS| NX/1\\.#" LEGACY_BROWSER ServerRoot "/etc/httpd" # #Listen 12.34.56.78:80 Listen 80 # # Example: # LoadModule foo_module modules/mod_foo.so # Include conf.modules.d/*.conf # # If you wish httpd to run as a different user or group, you must run # httpd as root initially and it will switch. # # User/Group: The name (or #number) of the user/group to run httpd as. # It is usually good practice to create a dedicated user and group for # running httpd, as with most system services. # User apache Group apache # # ServerAdmin: Your address, where problems with the server should be # e-mailed. This address appears on some server-generated pages, such # as error documents. e.g. admin@your-domain.com # ServerAdmin <私のメールアドレス> # # ServerName gives the name and port that the server uses to identify itself. # This can often be determined automatically, but we recommend you specify # it explicitly to prevent problems during startup. # # If your host doesn't have a registered DNS name, enter its IP address here. # ServerName <このサーバのホスト名>:80 # # Deny access to the entirety of your server's filesystem. You must # explicitly permit access to web content directories in other # <Directory> blocks below. # <Directory /> AllowOverride none Require all denied </Directory> # # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "/var/www/html" # # Relax access to content within /var/www. # # <Directory "/var/www"> # AllowOverride None # # Allow open access: # Require all granted # </Directory> # Further relax access to the default document root: <Directory "/var/www"> # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # # Require all granted </Directory> # # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module> DirectoryIndex index.html </IfModule> # スラッシュで終わるURLを、「index」を追加したURLにリダイレクトする # RedirectMatch permanent ^(.*)/$ $1/index # # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # <Files ".ht*"> Require all denied </Files> # # ErrorLog: The location of the error log file. # If you do not specify an ErrorLog directive within a <VirtualHost> # container, error messages relating to that virtual host will be # logged here. If you *do* define an error logfile for a <VirtualHost> # container, that host's errors will be logged there and not here. # ErrorLog "logs/error_log" # # LogLevel: Control the number of messages logged to the error_log. # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. # LogLevel warn <IfModule log_config_module> # # The following directives define some format nicknames for use with # a CustomLog directive (see below). # LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common <IfModule logio_module> # You need to enable mod_logio.c to use %I and %O LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio </IfModule> # # If you prefer a logfile with access, agent, and referer information # (Combined Logfile Format) you can use the following directive. # CustomLog "logs/access_log" combined </IfModule> <IfModule alias_module> # # Redirect: Allows you to tell clients about documents that used to # exist in your server's namespace, but do not anymore. The client # will make a new request for the document at its new location. # Example: # Redirect permanent /foo http://www.example.com/bar <If "-n %{PATH_INFO}"> # 存在しないディレクトリがURLに含まれていれば、404 Not Found を返す Redirect 404 / </If> # # ScriptAlias: This controls which directories contain server scripts. # ScriptAliases are essentially the same as Aliases, except that # documents in the target directory are treated as applications and # run by the server when requested rather than as documents sent to the # client. The same rules about trailing "/" apply to ScriptAlias # directives as to Alias. # ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" </IfModule> # # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "/var/www/cgi-bin"> AllowOverride None Options None Require all granted </Directory> <IfModule mime_module> # # If the AddEncoding directives above are commented-out, then you # probably should define those extensions to indicate media types: # AddType application/x-compress .Z AddType application/x-gzip .gz .tgz # # Filters allow you to process content before it is sent to the client. # # To parse .shtml files for server-side includes (SSI): # (You will also need to add "Includes" to the "Options" directive.) # # AddType text/html .shtml # AddOutputFilter INCLUDES .shtml <If "-n reqenv('LEGACY_BROWSER')"> # XHTMLに対応していなければ AddType text/html .xhtml </If> </IfModule> # # Specify a default charset for all content served; this enables # interpretation of all content as UTF-8 by default. To use the # default browser choice (ISO-8859-1), or to allow the META tags # in HTML content to override this choice, comment out this # directive: # # AddDefaultCharset UTF-8 # content-typeヘッダにcharsetパラメータを付加する AddCharset utf-8 .xhtml .html .css .es .js .txt .json .xml .csv <IfModule mime_magic_module> # # The mod_mime_magic module allows the server to use various hints from the # contents of the file itself to determine its type. The MIMEMagicFile # directive tells the module where the hint definitions are located. # MIMEMagicFile conf/magic </IfModule> EnableSendfile on # Supplemental configuration # # Load config files in the "/etc/httpd/conf.d" directory, if any. IncludeOptional conf.d/*.conf ServerTokens ProductOnly Header always set x-content-type-options nosniff Header always set x-ua-compatible IE=edge
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。