导航:首页 > IDC知识 > ubuntunginx配置域名

ubuntunginx配置域名

发布时间:2020-11-08 21:26:37

1、如何在Ubuntu上通过Nginx设置HTTP认证

需要htpassword来创建和生成加密的用户用于基础认证(Basic Authentication)。通过以下命令安装apache2-utils。
sudo apt-get install apache2-utils

创建用户名和密码
在Nginx托管的网站目录下生成一个.htpasswd文件。如下的命令可以创建文件同步增加用户和加密的密码到文件中
sudo htpasswd -c /etc/nginx/.htpasswd exampleuser

命令行为提示你输入密码
New password:
Re-type new password:
Adding password for user exampleuser

htpaswd的文件格式如下:
login:password

注意:htpasswd需要对nginx运行用户可访问
更新Nginx配置
在你的网站的Nginx配置文件增加如下两行:
auth_basic "Restricted";auth_basic_user_file /etc/nginx/.htpasswd;

第二行是你的htpasswd文件位置。
举个例子,假如你的文件是/etc/nginx/sites-available/website_nginx.conf,通过vi或者其它编辑器打开该文件
sudo vi /etc/nginx/sites-available/website_nginx.conf

增加代码:
server { listen portnumber; server_name ip_address; location / { root /var/www/mywebsite.com; index index.html index.htm; auth_basic "Restricted"; #For Basic Auth
auth_basic_user_file /etc/nginx/.htpasswd; #For Basic Auth
}
}

刷新Nginx
为了使配置生效,需要刷新nginx配置,然后再访问
$ sudo /etc/init.d/nginx reload* Reloading nginx configuration...

2、ubuntu安装nginx配置文件在哪

当你执行 nginx -t
得时候,nginx会去测试你得配置文件得语法,并告诉你配置文件是否写得正确,同时也告诉了你配置文件得路径:
# nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

3、ubuntu使用nginx怎么创建站点

1.先从nginx官网下载最新的版本 http://nginx.org/download/nginx-1.7.8.tar.gz 2.解压nginx-1.7.8.tar.gz,然后执行下面操作即可 ./configure --prefix=/usr/local/nginx make make install

4、ubuntu nginx 怎么用localhost来访问

1、尝试命令行重启服务,察看是否正确:sudo
service
tomcat7
restart
#如果你用的tomcat6就替换之
2、如果能够成功启动,察看服务器的配置文件:
sudo
vi
/etc/tomcat7/server.xml
确保找到下面的端口信息,如果有说明
http://localhost:8080/应该可以访问。
3、查看系统日志:
cd
/var/log/tomcat7/
用less察看相应的日志,看错误原因,然后贴出代码。
另外把你的不能访问的页面截个图来看看!!!

5、在Ubuntu 里有没有什么命令确定 Nginx 配置文件位置

当你执行 nginx -t
得时候,nginx会去测试你得配置文件得语法,并告诉你配置文件是否写得正确,同时也告诉了你配置文件得路径:
# nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

6、如何在ubuntu下 安装nginx服务器

获取nginx源码
1、打开百度在搜索栏输入nginx找到nginx官网,点击进入;
2、点击最新发布版,进入下载地址;
3、找到最新源码,右击获取源码下载地址通过wget下载;
如何在ubuntu下 安装nginx服务器
如何在ubuntu下 安装nginx服务器
如何在ubuntu下 安装nginx服务器
如何在ubuntu下 安装nginx服务器
配置编译安装
配置
./configure --prefix=/usr/local/nginx
编译、安装
make && make install
配置过程可能出现:
错误描述:error: the HTTP rewrite mole requires the PCRE library
解决方法:
需要安装pcre包。
sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev
你可能还需要安装
sudo apt-get install openssl libssl-dev
如何在ubuntu下 安装nginx服务器
如何在ubuntu下 安装nginx服务器
3
启动nginx
进入nginx安装目录,找到nginx目录所在目录,执行./nginx -c /usr/local/nginx/conf/nginx.conf启动服务;
在浏览器输入web服务器地址http://127.0.0.1,浏览器显示速度超级快,显示如图说明nginx安装启动成功
如何在ubuntu下 安装nginx服务器

7、如何用nginx在ubuntu下搭建web服务器

1.开始说明
  首先需要跟大家说明一下,这个教程中使用的IP地址是192.168.0.23,主机名称为Server1.example.com这些设置可能会有所不同,你需要根据不同情况进行修改。

2安装Apache2
2.切换管理员身份
在Ubuntu中需要用root身份进行操作,所以用下面的命令确保以root身份登录:
sudo su
3.开始安装MySQL5
apt-get install mysql-server mysql-client
你将被要求提供一个MySQL的root用户的密码,我们需要在红色区域设置密码。
New password for the MySQL "root" user: <-- yourrootsqlpassword
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword
4.安装Apache2
Apache2的是作为一个Ubuntu的软件包,因此我们可以直接用下面命令安装它:
apt-get install apache2
5.安装PHP5
我们可以直接安装PHP5和Apache的PHP5的模块,如下:
apt-get install php5 libapache2-mod-php5
安装完需要重启
/etc/init.d/apache2 restart
6.测试的PHP5并获取PHP5安装的详细信息:
默认网站的文件根目录是在/var/www下中。现在我们将在该目录中创建一个小型PHP文件(info.php的)在浏览器中调用它。该文件将显示很多关于我们的PHP安装,如安装的PHP版本和有用的一些细节。
7.PHP5获得MySOL的支持
让PHP在MySQL中获得支持,我们可以安装的php-mysql软件包。安装一些其他的PHP5模块,以及您可能需要的应用程序,这是一个好主意:
apt-cache search php5
还安装需要安装的
apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
现在重新启动Apache2的:
/etc/init.d/apache2 restart
8.安装phpMyAdmin
phpMyAdmin是一个网络接口,通过它可以管理你的MySQL数据库。
apt-get install phpmyadmin
你会看到以下问题:
Web server to reconfigure automatically: <-- apache2
Configure database for phpmyadmin with dbconfig-common? <-- No

8、ubuntu node.js怎样绑定域名解析

使用nginx的反向代理,加入配置文件版

upstream web{
server 127.0.0.1:3000;
keepalive 64;
}
server {
listen       80;
server_name  你的域名权;
#access_log  /var/log/nginx/log/host.access.log  main;
#client_max_body_size 100m;
location / {
    proxy_read_timeout 300;
    proxy_pass http://web;
    proxy_set_header Host $http_host;
}
error_page  404              /404.html;
location = /50x.html {
    root   /usr/share/nginx/html;
    proxy_set_header Host $http_host;
}
}

9、ubuntu nginx配置文件在哪

https://.baidu.com/question/1447030838453791020.html
-供参考

10、ubuntu linux怎么配置web服务器

您好√

单纯的WEB服务器如nginx,只需要直接通过apt安装即可。

apt-get install nginx -y

安装完毕后您需要手动启动(service nginx start)并且手动配置(修改nginx.conf)。

您也可以使用一些Web控制面板,如Vestacp,AMH等拥有图形界面(web管理面板)的服务器管理系统。

也可以使用命令行类的web管理脚本,如lnmp。

由于知道不允许发链接,所以上面的还请百度搜索安装,都有一键脚本,很简单。

与ubuntunginx配置域名相关的知识