質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

Q&A

4回答

2424閲覧

取得したドメインをサーバ上のwww/html/hogehogeのDocumentRootに設定したい

akkkkin

総合スコア83

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

0グッド

0クリップ

投稿2016/12/02 02:05

編集2016/12/06 04:00

掲題の件でご質問です。

example.comというドメインを取得し、
サーバーの"www/html/hogehoge"内にWordPressを設置しました。

しかし、WordPressのサイトにアクセスするには
example.com/hogehogeとしないとアクセスできません。

設定したいこととしては
example.comで
WordPressのサイトにアクセスできるように設定したいです。

ついてはどのようにDocumentRootを設定すればいいでしょうか?
DNSは設定済みです。

■サーバー:さくらVPS
■ os:centos7

になります。

追記:
現在のhttpd.confのコードです。
↓↓↓↓↓↓↓

中略 # ServerRoot "/etc/httpd" # # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the <VirtualHost> # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses. # #Listen 12.34.56.78:80 Listen 80 # # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule' lines at this location so the # directives contained in it are actually available _before_ they are used. 中略 # # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. # # Do not add a slash at the end of the directory path. If you point # ServerRoot at a non-local disk, be sure to specify a local disk on the # Mutex directive, if file-based mutexes are used. If you wish to share the # same ServerRoot for multiple httpd daemons, you will need to change at # least PidFile. # ServerRoot "/etc/httpd" # # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the <VirtualHost> # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses. # #Listen 12.34.56.78:80 Listen 80 中略 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 root@localhost # # 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 www.example.com: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> # # Note that from this point forward you must specifically allow # particular features to be enabled - so if something's not working as # you might expect, make sure that you have specifically enabled it # below. # # # 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 All # Allow open access: Require all granted </Directory> # Further relax access to the default document root: DocumentRoot "/var/www/html" <Directory "/var/www/html"> # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # 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 Indexes 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 All # # 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> # # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # <Files ".ht*"> Require all denied </Files> 中略 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> # # The location and format of the access logfile (Common Logfile Format). # If you do not define any access logfiles within a <VirtualHost> # container, they will be logged here. Contrariwise, if you *do* # define per-<VirtualHost> access logfiles, transactions will be # logged therein and *not* in this file. # #CustomLog "logs/access_log" common # # 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 # # Alias: Maps web paths into filesystem paths and is used to # access content that does not live under the DocumentRoot. # Example: # Alias /webpath /full/filesystem/path # # If you include a trailing / on /webpath then the server will # require it to be present in the URL. You will also likely # need to provide a <Directory> section to allow access to # the filesystem path. 中略 # <Directory "/var/www/cgi-bin"> AllowOverride None Options None Require all granted </Directory> <IfModule mime_module> # # TypesConfig points to the file containing the list of mappings from # filename extension to MIME-type. # TypesConfig /etc/mime.types # # AddType allows you to add to or override the MIME configuration # file specified in TypesConfig for specific file types. # #AddType application/x-gzip .tgz # # AddEncoding allows you to have certain browsers uncompress # information on the fly. Note: Not all browsers support this. # #AddEncoding x-compress .Z #AddEncoding x-gzip .gz .tgz # # 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 中略 # in HTML content to override this choice, comment out this # directive: # AddDefaultCharset UTF-8 <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

以上ご教示いただければありがたいです。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

CHERRY

2016/12/04 02:01

httpd.conf や バーチャルホスト関係の設定を質問に記載していただけないでしょうか?
akkkkin

2016/12/05 02:32

回答ありがとうございます。httpd.confのコードを質問に追記しました。
退会済みユーザー

退会済みユーザー

2016/12/06 03:49

コードは コードブロックで利用し、外部を利用すべきではない
akkkkin

2016/12/06 04:02

外部の利用を取りやめました。外部を利用した理由は10000文字以上になってしまい保存ができなかったためです。ですが、コード内に中略をいれ不要な箇所は消すことでコードブロックでたいおうしました。教えて頂きありがとうございます。
退会済みユーザー

退会済みユーザー

2016/12/06 23:35

#から始まる行はコメント(不要箇所)なので削除してもいい行だったりする
退会済みユーザー

退会済みユーザー

2016/12/06 23:39

ちなみに LOADMODULEは 削除してはいけない。
guest

回答4

0

何故にマイナス評価。。。

そっか、さくらVPSでは httpd.conf では DocumentRootのPATHは変更できなくなったのか(いつ出来なくなったんだろう?)。
この回答は間違いらしいです。
質問者さんの関連質問:Apacheが起動しなくなりました。原因がわかりません。

Webサーバーはapacheですよね?
httpd.conf で DocumentRoot を検索し設定されているPATHを変更すればできると思います。

投稿2016/12/02 05:59

編集2016/12/04 00:17
Y.H.

総合スコア7914

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

過去の質問に同じ質問がありますので、そちらの URL を貼っておきます。

https://teratail.com/questions/56300

投稿2016/12/02 04:47

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

新しくDocumentRoot "/www/html/hogehoge2"とディレクトリを作成し、
その中にWordPressをインストールしてもアクセスできないのでしょうか?

→ Apacheの名前ベースのバーチャルホストの設定をすれば可能です。
↓以下のようになります。
http://hogehoge.com/ → ドキュメントルート/www/html/hogehogeを参照。
http://hogehoge2.com/ → ドキュメントルート/www/html/hogehoge2を参照。

▼ 名前ベースの仮想ホスト
http://www.adminweb.jp/apache/virtual/index2.html

投稿2016/12/07 02:17

pond

総合スコア350

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

apache設定ファイルhttpd.confのDocumentRootを以下のように設定しては如何でしょうか?
DocumentRoot "/www/html/hogehoge"

投稿2016/12/06 03:48

pond

総合スコア350

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

akkkkin

2016/12/06 04:04

DocumentRoot "/www/html/hogehoge"としているのは hogehoge.com/hogehogeというURLで表示させるのではなく、hogehoge.comで表示させたいためです。
pond

2016/12/06 08:33

Apacheのドキュメントルートを DocumentRoot "/www/html/hogehoge" と設定してるのであれば、 ワードプレスの一般設定のサイトURLを example.com と設定はされてますか? ※ワードプレスURLはいじらないで下さい。ワードプレスへアクセスできなく なることがありますので。
akkkkin

2016/12/07 00:22 編集

>※ワードプレスURLはいじらないで下さい。ワードプレスへアクセスできなく なることがありますので。 まさにアクセスできない状態になっていたので、DBからの書き換えがわからなく、 応急処置として、wp-config.phpでdefineで define('WP_HOME','http://example.com/hogehoge'); define('WP_SITEURL','http://example.com/hogehoge'); 設定しています。 上記のように設定すると管理画面に入れましたが、管理画面からの変更ができなくなっております。
akkkkin

2016/12/07 00:24

ちなみにドキュメントルートをDocumentRoot "/www/html/hogehoge"と設定すると 新しくDocumentRoot "/www/html/hogehoge2"とディレクトリを作成し、 その中にWordPressをインストールしてもアクセスできないのでしょうか?
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問