導航:首頁 > IDC知識 > centoshpptd域名綁定

centoshpptd域名綁定

發布時間:2020-11-21 23:12:12

1、centos 7 系統httpd 服務怎麼基於 埠訪問

安裝apache:yuminstallhttpdhttpd-devel啟動apache:/etc/init.d/httpdstart此時輸入伺服器的IP地址,應該看到apache的服務頁面,埠不用輸,apache默認就是使用80埠安裝mysql:yuminstallmysqlmysql-server啟動mysql:/etc/init.d/mysqldstart安裝phpyuminstallphpphp-devel重啟apache使php生效/etc/init.d/httpdrestart此時可以在目錄:/var/www/html/下建立一個PHP文件代碼:然後訪問這個文件,就能看到PHP的一些信息,php.ini配置文件的路徑可以在這個頁面上看到安裝php的擴展yuminstallphp-mysqlphp-gdphp-imapphp-ldapphp-odbcphp-pearphp-xmlphp-xmlrpc安裝完擴展之後需要再次重啟apache/etc/init.d/httpdrestart測試mysql是否鏈接成功的php代碼

2、centos編輯/etc/httpd/conf/httpd.conf文件對Apache伺服器進行詳細設置許可權不夠

沒有什麼區別的,centos默認的PS1是\u@\h \W提示符最後顯示的是當前工作目錄的basename,你的當前工作目錄在liuxin用戶的家目錄下,所以才是那樣的,你可以 cd / 就成前面的樣子嘛。還是建議您多學習基礎知識再搞apache,隨便讓它正常工作很簡單,維護起來就要些基礎了。你編輯配置文件時也是,先看看文件的許可權是什麼,你的普通用戶一般不會有修改/etc文件夾下文件的許可權,或者你根本就是把文件屬性改成了所有人不可寫,或者只讀了

3、centos查看apache用的是哪個httpd.conf

果進程復中無法找到制嘗試在啟動腳本中尋找,適用於yum安裝的apache,如下所示,可以看到啟動時apache載入配置文件的位置,其中apache運行的站點目錄可以在/etc/httpd/conf/httpd.conf中找到
#查看apache配置文件位置
sed -n '9,11p' /etc/init.d/httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd/httpd.pid
#查看apache站點目錄
grep "DocumentRoot" /etc/httpd/conf/httpd.conf|grep -v "#"
DocumentRoot "/var/www/html"

3. 通過編譯參數查找

apache_bin=$(find / -type f -name "httpd"|xargs -i ls -l {}|awk '{if($5>30000)print $NF}')
$apache_bin -V|grep HTTPD_ROOT
結果:-D HTTPD_ROOT="/etc/httpd"
#apache安裝在/etc/httpd 目錄下

4、騰訊雲主機安裝centos,搭建apache,開啟httpd服務,域名解析到公網,訪問公網ip卻不能訪問到apache首頁!

公網的 80埠要去電信備案的 不備案默認copy是訪問不了的 你吧公網埠映射改成別的埠試試
不過騰訊雲好像可以在網頁上備案 你找找看
如果確認80埠正常 吧你的apache 虛擬主機那段 配置發出來看看

5、centos 7 apache httpd更改默認web目錄問題

你把selinux禁用才可以正常訪問

6、centos6.5 php5.6已經綁定了httpd2.2怎樣換httpd2.4

目錄(?)[-]
一卸載系統自帶Apache
1准備工作
2安裝
3將Apache添加成httpd服務並開機自啟動
二安裝PHP5615
1 源代碼安裝PHP
2修改PHP的配置文件phpini
3修改Apache配置文件httpdconf相關修改以支持PHP4使用小技巧
三防火牆的管理
可能立刻會有人要問:為啥不裝MySQL,這是因為本次項目准備購買雲RDS,所以就不在系統中自己安裝MySql了。
言歸正傳,開始安裝系統。
一,卸載系統自帶Apache
首先我個人覺得應該要卸載掉系統中自帶的apache軟體:
首先我們檢查系統中是否已經安裝了httpd服務:
root@server ~]# rpm -qa|grephttpd
httpd-2.2.3-11.el5_2.centos.4
httpd-manual-2.2.3-11.el5_2.centos.4
說明:rpm –qa | grep mysql 命令是為了把mysql相關的包都列出來,我上面的例子是Linux默認安裝apache的rpm軟體包列表,如果是別的Linux版本列出來的列表有可能會不一樣,不過不用擔心,不管是什麼,卸載都從最下面的一個包開始,直到卸載掉第一個為止。
比如:在這個例子中,我們應該先卸載httpd-manual-2.2.3-11.el5_2.centos.4方法如下:
rpm –ehttpd-manual-2.2.3-11.el5_2.centos.4如果卸載不掉,則會顯示軟體的依賴關系,則可以刪除掉依賴的軟體,然後再來卸載當前軟體包。
如果實在覺得依賴軟體的關系鏈太長太復雜,則可以強行刪除,添加—nodeps參數即可,指令如下:
rpm –ehttpd-manual-2.2.3-11.el5_2.centos.4 --nodeps個人觀點:刪除掉自帶的apache對於今後確認apache出現的問題有好處。
1.1,准備工作
首先要下載所需軟體的源碼包,有如下這些:
apr-1.5.2.tar.gz
apr-util-1.5.4.tar.gz
pcre-8.36.tar.gz
httpd-2.4.17.tar.gz
PHP-5.6.15.tar.gz
把所有的源碼包上傳到伺服器上。
1.2,安裝Apache2.4
首先要安裝Apache的依賴庫
apr-1.5.2.tar.gz
apr-util-1.5.4.tar.gz
pcre-8.36.tar.gz
tar zxvf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure--prefix=/usr/local/apr
make && make install
tar zxvfapr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure--prefix=/usr/local/apr-util --with-apr=/usr/local/aprmake && make install
tar zxvf pcre-8.36.tar.gz
cd pcre-8.36
./configure --prefix=/usr/local/pcre--with-apr-util=/usr/local/apr-util --with-apr=/usr/local/aprmake && make install
安裝PCRE的時候遇到如下錯誤:
You need a C++ compiler forC++ support
解決方案是:
yum install -y gcc gcc-c++
注意:這個-y千萬不能少。
可以開始安裝Apache了,
解壓縮
cd httpd-2.4.17
./configure--prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util--with-pcre=/usr/local/pcre --enable-so --enable-rewritemake && make install
注意:之前安裝的時候從windows上復制的./configure配置參數,結果中間不知為何多出來一些換行符,導致運行結果出錯了,所以大家拷貝指令的時候一定要小心。
【報錯】/usr/bin/ld: cannotfind -l*
主要的原因是庫文件並沒有導入的ld檢索目錄中比如說我就遇到了如下兩個錯誤:
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
這兩個錯誤就表示:libssl.so和libcrypto.so這兩個文件並不在ld檢索的目錄下面。
這兩個so文件經過查找,其實就在/usr/local/ssl/lib文件夾下面,並且/usr/local/ssl/lib也已經存在於ld的配置文件中:/etc/ld.so.conf文件。但是就是沒有起作用。
我的解決方案是:我沒有去學習ld的工作機制,我在ld默認的Lib檢查目錄之一的/usr/local/lib中增加了以上兩個so文件的外鏈,指令如下:
cd /usr/local/lib
ln -sv/usr/local/ssl/lib/libssl.so libssl.soln -sv/usr/local/ssl/lib/libcrypto.so libcrypto.so這樣的話,apahce的報錯問題就解決了。
1.3,將Apache添加成httpd服務並開機自啟動
如果沒有httpd 服務的時候,每次啟動都要運行如下指令:
/usr/local/apache/bin/apachectl start
好難受的說,下面就將httpd裝到服務中,同理也可以用到其他服務的操作。
1.將apachectl文件copy一分到/etc/rc.d/init.d中,然後再/etc/rc.d/rc5.d中加入鏈接。
其中init.d中的腳本就相當於window中的注冊表,在系統啟動的時候某些指定的腳本被執行。而rc5.d就和rc3.d差不多吧。也都是一些腳本只是執行級別不同。
命令如下:
cp/usr/local/apache/bin/apachectl /etc/init.d/httpdln -s /etc/init.d/httpd/etc/rc.d/rc5.d/S85httpd2.運行chkconfig --list 發現列表中沒有httpd,通過chkconfig --add httpd來添加,可能會提示httpd服務不支持chkconfig,需要編輯/etc/rc.d/init.d/httpd在第二行添加以下注視信息:
# chkconfig: 345 85 15
# description:Activates/Deactivates Apache Web Server345代表哪些linux級別需要啟動httpd,啟動序號是85,關閉序號是15。
保存以後執行 chkconfig --addhttpd 添加成功3.運行chkconfig --list httpd 基本就存在了。然後就可以用了。service httpd start 和 service httpd stop二,安裝PHP5.6.15
2.1 源代碼安裝PHP
解壓縮
Cd php-5.6.15
配置參數太復雜於是去網上找了一個大牛的推薦,如下:
./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs--with-libxml-dir=/usr/include/libxml2 --with-config-file-path=/usr/local/apache2/conf--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config--with-gd--enable-gd-native-ttf --with-zlib--with-mcrypt--with-pdo-mysql=/usr/local/mysql --enable-shmop --enable-soap--enable-sockets--enable-wddx --enable-zip --with-xmlrpc --enable-fpm--enable-mbstring--with-zlib-dir --with-bz2 --with-curl --enable-exif--enable-ftp--with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib--with-freetype-dir=/usr/lib/於是乎遇到了一系列的報錯,推薦我之前的一篇文章介紹了常見錯誤的解決辦法:
http://blog.csdn.NET/dodott/article/details/49664379我遇到的問題如下:
【報錯】configure errorxml2-config not found. please check your libxml2 installation解決方案:
Centos: yum install libxml2
yum install libxml2-devel -y
【報錯】Configure: error:Please reinstall the BZip2 distribution解決方案:
centos: yum install bzip2bzip2-devel
debian: apt-get installbzip2-devel
【報錯】
configure: error: Pleasereinstall the libcurl distribution -easy.h should bein<curl-dir>/include/curl/解決方案:
centos: yum install curlcurl-devel (For Redhat & Fedora)【報錯】
configure: error: mcrypt.hnot found. Please reinstalllibmcrypt.
解決方案:
網上大部分給的方法是使用如下指令
yum install libmcryptlibmcrypt-devel (For Redhat & Fedora)但是基本上都沒有作用,系統甚至會提示:nothingto do。估計可能和YUM源的軟體版本太低有關系。
正確做法是自己下載源碼來安裝:
libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
#編譯(默認安裝到/usr/local/lib/)
./configure--prefix=/usr/local/libmcrypt
#執行安裝
make && make install
注意:這里的安裝路徑要記住,等會安裝PHP的時候會用到。
繼續回到PHP的安裝,此時的配置參數修改為:
./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs--with-libxml-dir=/usr/include/libxml2--with-config-file-path=/usr/local/apache2/conf--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-gd --enable-gd-native-ttf--with-zlib --with-pdo-mysql=/usr/local/mysql--enable-shmop --enable-soap--enable-sockets --enable-wddx --enable-zip--with-xmlrpc --enable-fpm--enable-mbstring --with-zlib-dir --with-bz2--with-curl --enable-exif--enable-ftp --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib--with-freetype-dir=/usr/lib/--with-mcrypt=/usr/local/libmcrypt修改內容是:
去掉了--with-mcrypt,在最後增加了--with-mcrypt=/usr/local/libmcrypt【報錯】configure: error:libjpeg.(a|so) not foundconfigure: error: png.h not found.
解決方法:
關於jpeg的問題,安裝如下軟體包
yum -y install libjpeg-devel
關於png的問題,安裝如下軟體包
yum -y install libpng-devel
【報錯】
configure: error: Cannot findMySQL header files under/usr/local/mysql.
Note that the MySQL clientlibrary is not bundled anymore!
這個問題是因為沒有安裝mysql,所以找不到mysql的運行庫。
但是本次安裝本身就不想安裝完整的mysql軟體,去php官網查了資料後找到如下一段翻譯文字:
「對於 php-5.3.0或更新版本,mysqli 默認使用Mysql Native Driver作為驅動。 這個驅動比libmysql會有一些優勢, --with-mysql=mysqlnd」
最終configure參數修改為:
./configure--prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs--with-libxml-dir=/usr/include/libxml2--with-config-file-path=/usr/local/apache2/conf --with-mysql=mysqlnd--with-mysqli=mysqlnd --with-gd --enable-gd-native-ttf --with-zlib--with-pdo-mysql=mysqlnd --enable-shmop --enable-soap --enable-sockets--enable-wddx --enable-zip --with-xmlrpc --enable-fpm --enable-mbstring --with-zlib-dir --with-bz2 --with-curl--enable-exif --enable-ftp --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib--with-freetype-dir=/usr/lib/ --with-mcrypt=/usr/local/libmcrypt注意:上面紅色標記出來的目錄就是後面php.ini需要放置的目錄。
到此終於把PHP的configure成功通過。
make 和 makeinstall。PHP安裝完畢。
2.2,修改PHP的配置文件php.ini
進入php源碼目錄,選擇php.ini-development復制一份到/usr/local/apache2/conf,並改名為php.ini使用vi打開,查找extension_dir,修改為extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20131226",讀者根據自己的PHP安裝目錄結構配置,目的是找到PHP的擴展庫。
查找extension=php_,去掉extension=php_curl.dll,extension=php_gd2.dll,extension=php_mbstring.dll,extension=php_mysql.dll,extension=php_mysqli.dll,extension=php_pdo_mysql.dll,extension=php_xmlrpc.dll前面 的分號。查找short_open_tag= Off把它修改成short_open_tag = On,讓其支持短標簽(我看注釋這個默認是打開的)。
從別人的伺服器上我還拷貝了如下文件放到
/usr/local/php/lib/php/extensions/no-debug-zts-20131226目錄,文件如下:
Imap.so
Mcrypt.so
Memcache.so
Openssl.so
Zip.so
然後在php.ini的最後增加如下配置文字:
extension=memcache.so
extension=openssl.so
extension=mcrypt.so
extension=zip.so
2.3,修改Apache配置文件httpd.conf相關修改以支持PHPvi/usr/local/apache/conf/httpd.conf
? 添加php支持。
【添加欄位一】
AddTypeapplication/x-httpd-php .php .phtmlAddType application/x-httpd-php-source.phps【添加欄位二】
<FilesMatch \.php$>
SetHandlerapplication/x-httpd-php
</FilesMatch>
? 添加默認索引頁面index.php,再找到「DirectoryIndex」,在index.html後面加上「 index.php」
DirectoryIndex index.htmlindex.php
? 3. 不顯示目錄結構,找到「Options Indexes FollowSymLinks」,修改為Options FollowSymLinks
? 4. 開啟Apache支持偽靜態,找到「AllowOverride None」,修改為AllowOverride All
重啟Apache
service httpd restart
提醒:實在不知道怎麼配置,就找個已經搭建成功的伺服器把配置文件弄過來對比一下。
此時還會遇到如下報錯:
httpd: Could not reliablydetermine the server's fully qualified domain name解決辦法:
linux :/usr/local/apache/conf
用記事本打開httpd.conf
將裡面的#ServerNamelocalhost:80注釋去掉即可。
【報錯】:我也曾經配置成了ServerName127.0.0.1:80,結果區域網其他電腦就沒法訪問了,原因不清楚。
到此,整個Apache+PHP5.6的環境搭建完畢。
2.4,使用小技巧
【查看Apache的版本號】
運行apache安裝目錄下的/bin/httpd -v,具體實踐後的指令是:
#進入apache安裝目錄
#cd /usr/local/apache2/bin
#./httpd -v
Server version: Apache/2.4.17(Unix)
Server built: Feb 23 2016 15:21:50
三,防火牆的管理
1) 重啟後生效
開啟: chkconfig iptables on
關閉: chkconfig iptables off
2) 即時生效,重啟後失效
開啟: service iptables start
關閉: service iptables stop
需要說明的是對於Linux下的其它服務都可以用以上命令執行開啟和關閉操作。

7、centos7中,如何配置httpd用域名進行訪問

?

8、在centos里解壓阿帕奇文件老搞不定 我的命令 tar -zxv hpptd-2.2.21.tar.gz 輸完沒反應

1.通常插入usb設備後復,在制/dev/目錄下通常是sda1或sdb1。不能直接用/dev/usb來表示usb設備。即使要寫數據到usb設備中,也需要先掛載,再讀寫數據。
mount /dev/sdb1 /mnt #這里假設usb設備插入系統後被識別為/dev/sdb1
2.tar命令要指定解壓出來的目錄需要跟-C參數。

綜述:tar -zxvf httpd-2.2.21.tar.gz -C /mnt

9、centos6.5下使用httpd部署項目無法訪問

把selinux禁用
vi /etc/sysconfig/selinux
修改
SELINUX=disabled
保存退出,重啟系統

10、為什麼我的Linux里沒有 /etc/httpd/conf/http.conf 這個文件????

為什麼我的Linux里沒有 /etc/httpd/conf/http.conf 這個文件????
yum install httpd httpd-devel -y 安裝完阿帕奇就有了
ls -lh /etc/httpd.conf≠/etc/httpd/conf/http.conf
路徑要仔細看,一個符號差別就不是一個位置了

與centoshpptd域名綁定相關的知識